在 Debian 里 getconf 查不到(命令不存在或查不到值),通常不是系统坏了,而是下面几种常见原因之一。
getconf 命令本身不存在bash: getconf: command not found
getconf 属于 libc 工具,由 libc-bin 提供。
sudo apt update
sudo apt install libc-bin
安装后一般就有:
which getconf
# /usr/bin/getconf
getconf NON_EXISTENT_VAR
# 没有任何输出
getconf 只支持系统定义的变量,不是任意环境变量。
getconf -a
常见可用示例:
getconf LONG_BIT
getconf _POSIX_VERSION
getconf PATH_MAX /
有些变量 必须带路径参数:
getconf NAME_MAX /
getconf OPEN_MAX
错误写法:
getconf NAME_MAX # 可能无输出
Docker 最小镜像、debootstrap 环境经常:
libc-bin检查:
echo $PATH
ls /usr/bin/getconf
getconf 能查环境变量(误解)getconf 不是 env / echo $VAR
| 工具 | 用途 |
|---|---|
getconf |
查系统配置 / 限制 |
env |
查环境变量 |
printenv |
查环境变量 |
which getconf
getconf -a | head
getconf LONG_BIT
如果以上都正常,说明 getconf 没问题,只是查的“东西不对”。
如果你愿意,可以把 具体命令 + 输出 贴出来,我可以直接告诉你为什么查不到。