The getconf command displays the system wide configuration variables, not to be confused with the bash environment variables. These system wide variables provide architecture information to your C binaries in the form of how many bits a long on is, or the maximum value of an int, among other things. These values can also show you whether your system is a 32-bit or 64-bit by displaying the length of a long. If your system is a 32 bit system the long is 32 bits in length, whereas on a 64 bit system a long is 64 bits.
List Of Interesting Variables
Using the getconf command with the -a flag will display system variables with the value, for example:
I took the liberty of removing some of the non-useful output.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | $ getconf -a ARG_MAX 2097152 ATEXIT_MAX 2147483647 CHAR_BIT 8 CHAR_MAX 127 CHAR_MIN -128 CHILD_MAX CLK_TCK 100 INT_MAX 2147483647 INT_MIN -2147483648 IOV_MAX 1024 LOGNAME_MAX 256 LONG_BIT 64 MB_LEN_MAX 16 NGROUPS_MAX 65536 NL_ARGMAX 4096 NL_LANGMAX 2048 NL_MSGMAX 2147483647 NL_NMAX 2147483647 NL_SETMAX 2147483647 NL_TEXTMAX 2147483647 NZERO 20 OPEN_MAX 1024 PAGESIZE 4096 PAGE_SIZE 4096 PASS_MAX 8192 PTHREAD_DESTRUCTOR_ITERATIONS 4 PTHREAD_KEYS_MAX 1024 PTHREAD_STACK_MIN 16384 PTHREAD_THREADS_MAX SCHAR_MAX 127 SCHAR_MIN -128 SHRT_MAX 32767 SHRT_MIN -32768 SSIZE_MAX 32767 TTY_NAME_MAX 32 TZNAME_MAX 6 UCHAR_MAX 255 UINT_MAX 4294967295 UIO_MAXIOV 1024 ULONG_MAX 18446744073709551615 USHRT_MAX 65535 WORD_BIT 32 |
A few of the interesting variables include the LONG_BIT indicating this is a 64bit machine as the length of the long is 64 bits. Here is some information of what each of these values mean:
| ARG_MAX | Maximum length, in bytes, of the arguments for one of the exec subroutines, including environment data. |
| CHAR_BIT | Number of bits in a type character. |
| CHAR_MAX | Maximum value of a type character. |
| CHAR_MIN | Minimum value of a type character. |
| CHILD_MAX | Maximum number of simultaneous processes for each real user ID. |
| CLK_TCK | Number of clock ticks per second returned by the time subroutine. |
| INT_MAX | Maximum value of a type int. |
| INT_MIN | Minimum value of a type int. |
| LONG_BIT | Number of bits in a type long int. |
| LONG_MAX | Maximum value of a type long int. |
| LONG_MIN | Minimum value of a type long int. |
| MB_LEN_MAX | Maximum number of bytes in a character for any supported locale. |
| NGROUPS_MAX | Maximum number of simultaneous supplementary group IDs for each process. |
| NL_ARGMAX | Maximum value of digit in calls to the printf and scanf subroutines. |
| NL_LANGMAX | Maximum number of bytes in a LANG name. |
| NL_MSGMAX | Maximum message number. |
| NL_NMAX | Maximum number of bytes in an N-to-1 collation mapping. |
| NL_SETMAX | Maximum set number. |
| NL_TEXTMAX | Maximum number of bytes in a message string. |
| NZERO | Default process priority. |
| OPEN_MAX | Maximum number of files that one process can have open at one time. |
| SCHAR_MAX | Maximum value of a type signed char. |
| SCHAR_MIN | Minimum value of a type signed char. |
| SHRT_MAX | Maximum value of a type short. |
| SHRT_MIN | Minimum value of a type short. |
| SSIZE_MAX | Maximum value of an object of type ssize_t. |
| TZNAME_MAX | Maximum number of bytes supported for the name of a time zone (not the length of the TZ environment variable). |
| UCHAR_MAX | Maximum value of a type unsigned char. |
| UINT_MAX | Maximum value of a type unsigned int. |
| ULONG_MAX | Maximum value of a type unsigned long int. |
| USHRT_MAX | Maximum value of a type unsigned short int. |
| WORD_BIT | Number of bits in a word or type int. |
If you already know the name of the variable you are looking for you can simply type:
1 2 | $ getconf LONG_BIT
64 |
Or
1 2 | $ getconf WORD_BIT
32 |
and so on. This gives you a general idea of some of the values your C compiler uses when allocating memory needs for your integers or your longs.


