在 Debian(以及其它使用 glibc 的 Linux 系统)中,getconf 本身没有一个直接“列出所有变量”的标准选项,但可以通过下面几种方式查看可用变量。
getconf 支持的变量来自 POSIX / SISO / 系统限制,可以通过以下方式列出:
getconf -a
这会列出大量系统配置变量,例如:
LINK_MAX 65000
_POSIX_MAX_CANON 255
_POSIX_MAX_PATH 4096
PATH_MAX 4096
...
✅
-a是最常用、最直接的方式
getconf -a | grep PATH
getconf -a | grep _POSIX
有些变量是专门给 getconf 用的,例如:
getconf LONG_BIT
getconf PAGE_SIZE
getconf _NPROCESSORS_ONLN
你可以查看 glibc 文档或源码来了解更多:
man getconf
getconf 的底层来自这些头文件:
<limits.h><unistd.h><sys/stat.h>例如:
getconf NAME_MAX /
在 Debian 中:
getconf 来自 libc-binsudo apt install libc-bin
| 目的 | 命令 |
|---|---|
| 列出所有 getconf 变量 | getconf -a |
| 查看特定变量 | getconf 变量名 |
| 查看路径相关 | getconf -a | grep PATH |
如果你有具体想查的变量(如线程数、文件大小、CPU 位数),可以直接告诉我。