GETCONF(1POSIX)
GETCONF(1POSIX) π
POSIX Programmer's Manual β yeah bestie, this is a POSIX page, not a Linux one, iykyk.
PROLOG β¨
Okay so quick heads up before we get into it: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so like, go consult the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface may just not be implemented on Linux at all. π Not every system is gonna have it, fr fr.
NAME π
getconf β get configuration values. That's it, that's the whole job. She's a simple girl with one purpose and she slays at it.
SYNOPSIS π¦
getconf [-v specification] system_var
getconf [-v specification] path_var pathname
Two forms, two vibes. Pick your fighter. π
DESCRIPTION πΈ
So in the first synopsis form, getconf shall write to the standard output the value of the variable specified by the system_var operand. Like, you ask a question, she answers it, no drama. β¨
In the second synopsis form, getconf shall write to the standard output the value of the variable specified by the path_var operand for the path specified by the pathname operand. So this time it's path-specific, okay? Not a one-size-fits-all situation. π
And here's the important bit: the value of each configuration variable shall be determined as if it were obtained by calling the function from which it's defined to be available by this volume of POSIX.1β2017 or by the System Interfaces volume of POSIX.1β2017 (peep the OPERANDS section for that). And the value shall reflect conditions in the current operating environment. Not yesterday's environment, not some hypothetical environment. Current. Periodt. π―
OPTIONS β
getconf shall conform to the Base Definitions volume of POSIX.1β2017, Section 12.2, Utility Syntax Guidelines. We stay compliant, bestie, it's giving well-behaved utility. π
The following option shall be supported:
-vspecification β Indicate a specific specification and version for which configuration variables shall be determined. If this option is not specified, the values returned correspond to an implementation default conforming compilation environment. So like, if you don't say which flavor, you get the house default. π
Now here's where it gets a little extra, and honestly? We love her for it. The -v option has a whole set of conditional behaviors based on what your system says. Watch this:
If the command:
getconf _POSIX_V7_ILP32_OFF32
does not write "-1\n" or "undefined\n" to standard output, then commands of the form:
getconf -v POSIX_V7_ILP32_OFF32 ...
determine values for configuration variables corresponding to the POSIX_V7_ILP32_OFF32 compilation environment specified in c99, the EXTENDED DESCRIPTION. π§
If the command:
getconf _POSIX_V7_ILP32_OFFBIG
does not write "-1\n" or "undefined\n" to standard output, then commands of the form:
getconf -v POSIX_V7_ILP32_OFFBIG ...
determine values for configuration variables corresponding to the POSIX_V7_ILP32_OFFBIG compilation environment specified in c99, the EXTENDED DESCRIPTION. β¨
If the command:
getconf _POSIX_V7_LP64_OFF64
does not write "-1\n" or "undefined\n" to standard output, then commands of the form:
getconf -v POSIX_V7_LP64_OFF64 ...
determine values for configuration variables corresponding to the POSIX_V7_LP64_OFF64 compilation environment specified in c99, the EXTENDED DESCRIPTION. π
If the command:
getconf _POSIX_V7_LPBIG_OFFBIG
does not write "-1\n" or "undefined\n" to standard output, then commands of the form:
getconf -v POSIX_V7_LPBIG_OFFBIG ...
determine values for configuration variables corresponding to the POSIX_V7_LPBIG_OFFBIG compilation environment specified in c99, the EXTENDED DESCRIPTION. π¦
See the pattern? Probe with getconf first, and if it doesn't come back with -1 or undefined, then that -v environment is live and you can use it. She's doing a vibe check on herself. Iconic behavior honestly. ππ
OPERANDS π
The following operands shall be supported:
path_varβ A name of a configuration variable. All of the variables in the Variable column of the table in the DESCRIPTION of thefpathconf()function defined in the System Interfaces volume of POSIX.1β2017, without the enclosing braces, shall be supported. The implementation may add other local variables. So drop the{}, okay? We're not curly-brace girlies here. πpathnameβ A pathname for which the variable specified bypath_varis to be determined. The "where" to your "what". πsystem_varβ A name of a configuration variable. All of the following variables shall be supported:- The names in the Variable column of the table in the DESCRIPTION of the
sysconf()function in the System Interfaces volume of POSIX.1β2017, except for the entries corresponding to_SC_CLK_TCK,_SC_GETGR_R_SIZE_MAX, and_SC_GETPW_R_SIZE_MAX, without the enclosing braces. Those three are getting left on read, sorry babes. π
- The names in the Variable column of the table in the DESCRIPTION of the
For compatibility with earlier versions, the following variable names shall also be supported: POSIX2_C_BIND POSIX2_C_DEV POSIX2_CHAR_TERM POSIX2_FORT_DEV POSIX2_FORT_RUN POSIX2_LOCALEDEF POSIX2_SW_DEV POSIX2_UPE POSIX2_VERSION
and shall be equivalent to the same name prefixed with an <underscore>. This requirement may be removed in a future version. So like, use it but don't get too attached. π
- The names of the symbolic constants used as the name argument of the
confstr()function in the System Interfaces volume of POSIX.1β2017, without the_CS_prefix. Shed the prefix, keep the glow. β¨ - The names of the symbolic constants listed under the headings
Maximum ValuesandMinimum Valuesin the description of the<limits.h>header in the Base Definitions volume of POSIX.1β2017, without the enclosing braces. Again: no braces. π
For compatibility with earlier versions, the following variable names shall also be supported: POSIX2_BC_BASE_MAX POSIX2_BC_DIM_MAX POSIX2_BC_SCALE_MAX POSIX2_BC_STRING_MAX POSIX2_COLL_WEIGHTS_MAX POSIX2_EXPR_NEST_MAX POSIX2_LINE_MAX POSIX2_RE_DUP_MAX
and shall be equivalent to the same name prefixed with an <underscore>. This requirement may be removed in a future version. Same energy as before, bestie β legacy support, lowkey on its way out. π
The implementation may add other local values. Surprise extras, we love a bonus. π
STDIN πΏ
Not used. She doesn't want your input, she's got this. π
INPUT FILES π
None. Zero. Nada. Nothing to see here. β¨
ENVIRONMENT VARIABLES πΈ
The following environment variables shall affect the execution of getconf:
LANGβ Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of POSIX.1β2017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) Basically the backup dancer when nobody else shows up. πLC_ALLβ If set to a non-empty string value, override the values of all the other internationalization variables. She's the main character β when she's here, everyone else sits down. πLC_CTYPEβ Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments). It's giving "how do we read the bytes, bestie". π€LC_MESSAGESβ Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. So when something goes wrong, how it yells at you is her call. πNLSPATHβ Determine the location of message catalogs for the processing ofLC_MESSAGES. She's the map to where the messages live. πΊοΈ
ASYNCHRONOUS EVENTS π¦
Default. Nothing special happening here, no cap. β
STDOUT β
Okay so here's how the output works, and it's actually kind of a choose-your-own-format situation:
If the specified variable is defined on the system and its value is described to be available from the confstr() function defined in the System Interfaces volume of POSIX.1β2017, its value shall be written in the following format:
"%s\n", <value>
Otherwise, if the specified variable is defined on the system, its value shall be written in the following format:
"%d\n", <value>
If the specified variable is valid, but is undefined on the system, getconf shall write using the following format:
"undefined\n"
If the variable name is invalid or an error occurs, nothing shall be written to standard output. Silence. Ghosted. Nothing. π
STDERR π
The standard error shall be used only for diagnostic messages. She's a one-job channel, and that job is complaining when something's wrong. π’
OUTPUT FILES π
None. β¨
EXTENDED DESCRIPTION π
None. Moving on, babes. π
EXIT STATUS π₯
The following exit values shall be returned:
0β The specified variable is valid and information about its current state was written successfully. We ate. β>0β An error occurred. Not the vibe. π
CONSEQUENCES OF ERRORS π
Default.
The following sections are informative.
APPLICATION USAGE πΏ
None. Yeah, she said what she said. π
EXAMPLES πΈ
Okay here's where it gets fun, bestie. Actual receipts. π
The following example illustrates the value of {NGROUPS_MAX}:
getconf NGROUPS_MAX
The following example illustrates the value of {NAME_MAX} for a specific directory:
getconf NAME_MAX /usr
The following example shows how to deal more carefully with results that might be unspecified:
if value=$(getconf PATH_MAX /usr); then
if [ "$value" = "undefined" ]; then
echo PATH_MAX in /usr is indeterminate.
else
echo PATH_MAX in /usr is $value.
fi
else
echo Error in getconf.
fi
See what she did there? She's checking the exit status first, then checking whether the answer came back as undefined, and only then trusting the number. Because "undefined" is a valid answer that still exits 0, and an error is a whole different thing. Two checks, zero confusion. That's the move. π
RATIONALE π§
Storytime, bestie, because the lore is actually kinda good. π
The original need for this utility, and for the confstr() function, was to provide a way of finding the configuration-defined default value for the PATH environment variable. Why? Because PATH can be modified by the user to include directories that could contain utilities replacing the standard utilities, so shell scripts need a way to determine the system-supplied PATH environment variable value β the one that contains the correct search path for the standard utilities. It was later suggested that access to the other variables described in this volume of POSIX.1β2017 could also be useful to applications. And honestly? They were right. π
This functionality of getconf would not be adequately subsumed by another command such as:
grep var /etc/conf
because such a strategy would provide correct values for neither those variables that can vary at runtime, nor those that can vary depending on the path. Like, a static file could never, it's not giving what needs to be gave. π
Also, early proposal versions of getconf specified exit status 1 when the specified variable was valid, but not defined on the system. The output string "undefined" is now used to specify this case with exit code 0 because so many things depend on an exit code of zero when an invoked utility is successful. So: success is success, even when the answer is "idk". π
FUTURE DIRECTIONS π¦
None. She's staying exactly as she is. β¨
SEE ALSO π
c99- The Base Definitions volume of POSIX.1β2017, Chapter 8, Environment Variables, Section 12.2, Utility Syntax Guidelines,
<limits.h> - The System Interfaces volume of POSIX.1β2017,
confstr(),fpathconf(),sysconf(),system()
to be continuedβ¦ π (there's more, don't go anywhere)
π COPYRIGHT π
Okay bestie, legal era. Stay with me, it's short.
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. πβ¨
Real talk though: in the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. Like, that one's the main character, this one's the cover. π The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
And if you spot any typographical or formatting errors in this page? Chances are they got introduced during the conversion of the source files to man page format (not a vibe, but it happens π). To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
And that's the whole page, babes π«Ά β this one came from IEEE/The Open Group, dated 2017, and it's the man page for GETCONF(1POSIX). Go forth and configure, you absolute icon. π
πΈπ¦
π¦ where this page comes from
- debian bookworm: manpages-posix 2017a-2 Β· Other
- debian trixie: manpages-posix 2017a-2 Β· Other
- ubuntu jammy: manpages-posix 2017a-2 Β· Other
- ubuntu noble: manpages-posix 2017a-2 Β· Other
- ubuntu resolute: manpages-posix 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms