Learn about your system configuration using getconf

I recently learnt about a simple program named getconf that can be used to query and view values of various system configuration variables. It is a POSIX program that ships with the GNU C Library (glibc) and so should be available on any Linux system. It can be used to query system variables and path variables from the shell.

  • To view all the variables and values that this program handles:
$ getconf -a
  • To query a specific variable:
$ getconf INT_MAX
  • Some of the getconf variables that I find interesting:

  • In case you are curious, getconf just calls the sysconf function provided by the GNU C Library. This can be seen in the posix/getconf.c source file in glibc.

  • To get the cache details of an Intel 64-bit x86 CPU, sysconf uses the cpuid assembly instruction. This can be seen in the sysdeps/x86_64/cacheinfo.c source file in glibc.

Tried with: GLibC 2.19 and Ubuntu 14.04

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s