I accidentally deleted my .config for my kernel configuration on Linux, and seem to remember there was a way to retrieve the kernel configuration via the proc filesystem somehow.

Is this still possible, and if so how would I do it?


Depending on your system, you'll find it in any one of these:

  1. /proc/config.gz
  2. /boot/config
  3. /boot/config-$(uname -r)

and possibly more places.

  • 4
    On some distros (Fedora/Redhat) it's /boot/config-2.6.18-194.el5 or similar, with the kernel release string appended. – Phil May 23 '11 at 15:50
  • 1
    @Phil I run a distro (Zenwalk) where those filenames are symlinked by the latest kernel package to /boot/config. I'll go ahead and add these to the list - thanks for reminding me. – new123456 May 23 '11 at 20:15
  • in /boot/config-$(uname -r) for amazon linux and likely RHEL – aeb0 Nov 27 '16 at 23:47
  • 1
    Not existing such files on Ubuntu Mate or Kali Linux for RaspBerry Pi. – Sopalajo de Arrierez Oct 5 '17 at 23:23
  • 1
    You should mention that your first item (/proc) is only available if module "configs" is loaded – Andy Feb 27 '18 at 7:41

For an actual running kernel, one way to get the config file this is to

cat /proc/config.gz | gunzip > running.config


zcat /proc/config.gz > running.config

Then running.config will contain the configuration of the running linux kernel.

However this is only possible if your running linux kernel was configured to have /proc/config.gz. The configuration for this is found in

  • General setup
    • [*] Kernel .config support
      • [*] Enable access to .config through /proc/config.gz

Most distributions do not have this configuration set. They provide kernel config files in their kernel packages and is usually found in /boot/ directory.

  • 5
    These are known as CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC, if you're grepping for them. – chronospoon Mar 26 '15 at 18:34
  • 2
    zcat /proc/config.gz works fine. – Quanlong Aug 22 '16 at 4:15

A Little bit late but maybe it helps someone. I didn't have /proc/config.gz nor /boot/config nor /boot/config-$(uname -r) on my Computer. I had to run modprobe configs as root. Then, /proc/config.gz was present

  • Can confirm on Intel MIC embedded Linux (BusyBox), this is necessary and works. – Mark Lakata Feb 23 '16 at 18:59
  • 4
    Same for Raspbian on Raspberry Pi 2 – Drew McGowen Mar 24 '16 at 2:39
  • 2
    FATAL: Module configs not found. on OMV 2.2 (Debian Wheezy) so glad they provided it in /boot/config-$(uname -r) – tuk0z Apr 12 '16 at 11:42
  • You sir, saved my day. Have a +1 – Christian Jan 14 '18 at 10:26
  • 'modprobe configs' is very helpful I had tests that automatically probe kconfig that were failing on a Raspberry Pi 3, but now work. Thanks for the tip!! – Tim Bird Jan 3 at 0:40

If you couldn't find kernel configuration in /boot/ nor in /proc/config.gz, you can try extracting this information from the kernel itself.

Inside any kernel source code there is a script for extracting config located in scripts/extract-ikconfig, pass the kernel you want its configuration as parameter to this script.

This solution will only work if Kernel .config support was enabled in the compiled kernel.

  • 2
    This was extremely helpful and helped me to obtain plenty of configs I didn't expect to ever see. Thanks! – selurvedu Oct 2 '17 at 14:16

Independently of the distribution, you can run: cat /lib/modules/$(uname -r)/build/.config

Source: https://linux.die.net/man/5/proc (search for /proc/config).


For RedHat-based distributions, the .config file of the off-the-shelf kernel can be found with the command cat /lib/modules/$(uname -r)/build/.config that's available after the package kernel-devel is installed using the command:

yum -y install kernel-devel

Note that with the real Red Hat Enterprise Linux distribution, you will need to enable the source-repository to get this package. On RHEL8, use the following command to do that:

subscription-manager repos --enable=rhel-8-for-x86_64-baseos-source-rpms

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.