Linux: Get Kernel Config

Objective: Get Linux kernel config from currently running system or from a kernel image file.

If the kernel was compiled with CONFIG_IKCONFIG (found under General setup – Kernel .config support – Enable access to .config through /proc/config.gz), then the config file can be extracted from /proc/config.gz. It is gzip compressed and it can be extracted using the following syntax.

The above command will create a config file called linux-4.4.0-24-generic.config where 4.4.0-24-generic is the Linux kernel version that is currently running.

If the /proc/config.gz file is not found, try loading the configs kernel module. This helps in some cases.

On some Linux distributions, the kernel config file can be found under the /boot directory.

The config file under /boot is usually bundled in the linux-image package.

If you would like to extract the config from a kernel image file, install the extract-ikconfig script on your system. Once installed, run the script with the path to the kernel image. An example is shown below.

The linux-4.4.0-24-generic.config output file will contain the kernel config. Note the the script will only work if the kernel was compiled with CONFIG_IKCONFIG option.

ibrahim = { interested_in(unix, linux, android, open_source, reverse_engineering); coding(c, shell, php, python, java, javascript, nodejs, react); plays_on(xbox, ps4); linux_desktop_user(true); }