LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

getconf

POSIX system configuration variable query tool

TLDR

List all configuration values available
$ getconf -a
copy
List the configuration values for a specific directory
$ getconf -a [path/to/directory]
copy
Check if the system is 32-bit or 64-bit
$ getconf LONG_BIT
copy
Check how many processes the current user can run at once
$ getconf CHILD_MAX
copy
List every configuration value and filter with grep
$ getconf -a | grep MAX
copy

SYNOPSIS

getconf [-v spec] systemvar_getconf [-v spec] pathvar pathname_

DESCRIPTION

getconf retrieves system configuration variables defined by POSIX and system-specific extensions. These values represent system limits and capabilities that applications can query to adapt their behavior.Variables fall into two categories: system-wide values (like CHILDMAX, PAGESIZE) and pathname-specific values (like PATHMAX, NAMEMAX) that may vary by filesystem.This is useful for shell scripts that need to query system limits without hardcoding values, ensuring portability across different systems.

PARAMETERS

-a

Display all configuration variables and their values
-v SPEC
Use specification SPEC for configuration values
LONG_BIT
Number of bits in a long integer (32 or 64)
CHILD_MAX
Maximum number of processes per user
OPEN_MAX
Maximum number of files a process can have open
PAGE_SIZE
System memory page size in bytes
PATH_MAX
Maximum length of a file path
HOST_NAME_MAX
Maximum length of a hostname
ARG_MAX
Maximum length of arguments to the exec functions
_NPROCESSORS_CONF
Number of processors configured
_NPROCESSORS_ONLN
Number of processors currently online

INSTALL

sudo apt install libc-bin
copy
sudo apk add musl-utils
copy
nix profile install nixpkgs#getconf
copy

CAVEATS

Some values may be indeterminate (shown as "undefined"). Pathname-specific variables can return different values for different filesystems. Not all variables are supported on all systems.

HISTORY

getconf is part of the POSIX standard and has been available on Unix-like systems since the early 1990s. It provides a standardized way to query the same configuration values that the C functions sysconf(), pathconf(), and confstr() return.

SEE ALSO

sysctl(8), ulimit(1), nproc(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid