The /proc/sys directory in the /proc virtual filesytem contains a lot of useful and interesting files and directories. Many kernel settings can be manipulated by writing to files in the proc filesystem. A lot of important information can be retrieved from these files. This is especially useful when you are troubleshooting or fine tuning your linux system.
Following is a description of the most important files.
Especially the files in /proc/sys/vm are very interesting and useful.
You can also use the sysctl command to make this changes persistent, or to see all the possible kernel options you can change at run-time.
/proc/sys/dev
Contains device specific information. For instance the directory cdrom /proc/sys/dev/cdrom/info shows you cdrom capabilities. The other files in /proc/sys/dev/cdrom are writable and allow you to actually set options for your cdrom drive.
For instance echo 1 > /proc/sys/dev/cdrom/autoeject makes your tray open automagically when you unmount your cdrom.
/proc/sys/dev/parport holds information about parallel ports. Browse these directories to learn more about their contents.
/proc/sys/fs
Virtual filesystem information/tuning
/proc/sys/fs/binfmt_misc
binfmt_misc allows you to configure the system to execute miscellaneous binary formats. For instance it enables you to make the system execute .exe files using wine and java files using the java interpreter, just by typing a file name.
/proc/sys/fs/dentry-state
Linux caches directory access to speed up sub-sequential access to the same directory, this file contains information about the status of the directory cache.
/proc/sys/fs/dir-notify-enable
enable/disable dnotify interface, dnotify is a signal used to notify a process about file/directory changes. This is mainly interesting to programmers.
/proc/sys/fs/dquot-nr
number of allocated disk quota entries and the number of free disk quota entries
/proc/sys/fs/dquot-max
maximum number of cached disk quota entries.
/proc/sys/fs/file-max
system-wide limit on the number of open files for all processes.
/proc/sys/fs/file-nr
number of files the system has presently opened.
/proc/sys/fs/inode-max
maximum number of in-memory inodes
/proc/sys/fs/inode-nr
number of inodes and number of free inodes
/proc/sys/fs/inode-state
This file contains seven numbers: number of inodes, number of free inodes, preshrink, and four dummy values. nr_inodes is the number of inodes the system has allocated. Preshrink is non-zero when the nr_inodes is bigger than inode-max.
/proc/sys/fs/inotify
(since kernel 2.6.13)
This directory contains files that can be used to limit the amount of kernel memory consumed by the inotify interface.
/proc/sys/fs/lease-break-time
This file specifies the grace period that the kernel grants to a process holding a file lease after it has sent a signal to that process notifying it that another process is waiting to open the file.
/proc/sys/fs/leases-enable
This file can be used to enable or disable file leases on a system-wide basis.
/proc/sys/fs/mqueue
(since kernel 2.6.6)
This directory contains files controlling the resources used by POSIX message queues.
/proc/sys/fs/overflowgid
Allows you to change the value of the fixed GID, if a filesystem is mounted which only supports 16 bit GID's the Linux GID's which are 32 bit sometimes need to be converted to lower values this is fixed at this value.
/proc/sys/fs/overflowuid
Allows you to change the value of the fixed UID, if a filesystem is mounted which only supports 16 bit UID's the Linux UID's which are 32 bit sometimes need to be converted to lower values this is fixed at this value.
/proc/sys/fs/suid_dumpable
(since kernel 2.6.13)
Determines whether core dump files are produced for set-user-ID or otherwise protected/tainted binaries.
Possible values are 0,1,2:
0 (default) A core dump will not be produced for a process which has changed credentials or whose binary does not have read permission enabled.
1 (debug) All processes dump core when possible.
2 (suidsafe) Any binary which normally would not be dumped is dumped readable by root only. This allows the user to remove the core dump file but not to read it. For security reasons core dumps in this mode will not overwrite one another or other files. This mode is appropriate when administrators are attempting to debug problems in a normal environment.
/proc/sys/fs/super-max
Controls the maximum number of superblocks, and thus the maximum number of mounted file systems the kernel can have.
/proc/sys/fs/super-nr
The number of file systems currently mounted.
/proc/sys/kernel/acct
highwater, lowwater, and frequency. Used with BSD-style process accounting.
/proc/sys/kernel/cap-bound
(from Linux 2.2 to 2.6.24)
Holds the value of the kernel capability bounding set.
/proc/sys/kernel/core_pattern
Can be used to define a template for naming core dump files
/proc/sys/kernel/core_uses_pid
See core(5).
/proc/sys/kernel/ctrl-alt-del
Controls the handling of Ctrl-Alt-Del from the keyboard.
If it's 0, Linux will do a graceful restart. When the value is > 0, Linux’s will do an immediate reboot, without even syncing its dirty buffers.
/proc/sys/kernel/hotplug
Contains the path for the hotplug policy agent. Can be used to set the NIS/YP domainname
/proc/sys/kernel/domainname
can be used to set the NIS/YP domainname
/proc/sys/kernel/hostname
can be used to set the hostname
/proc/sys/kernel/modprobe
Contains the path for the kernel module loader.
/proc/sys/kernel/msgmax
This file defines a system-wide limit specifying the maximum number of bytes in a single message written on a System V message queue.
/proc/sys/kernel/msgmnb
Defines a system-wide parameter used to initialize the msg_qbytes setting for subsequently created message queues.
/proc/sys/kernel/ostype and /proc/sys/kernel/osrelease
These files give substrings of /proc/version.
/proc/sys/kernel/overflowgid and /proc/sys/kernel/overflowuid
These files duplicate the files /proc/sys/fs/overflowgid and /proc/sys/fs/overflowuid.
/proc/sys/kernel/panic
Gives read/write access to the kernel variable panic_timeout. If this is zero, the kernel will loop on a panic; if non-zero it indicates that the kernel should autoreboot after this number of seconds.
/proc/sys/kernel/panic_on_oops
(since kernel 2.5.68)
This file controls the kernel’s behavior when an oops or BUG is encountered. If this file contains 0, then the system tries to continue operation. If it contains 1, then the system delays a few seconds and then panics. If the /proc/sys/kernel/panic file is also non-zero then the machine will be rebooted.
/proc/sys/kernel/pid_max
(since kernel 2.5.34)
This file specifies the value at which PIDs wrap around (i.e., the value in this file is one greater than the maximum PID).
/proc/sys/kernel/printk
The four values in this file are console_loglevel, default_message_loglevel, minimum_console_level, and default_console_loglevel. This allows configuration of which messages will be logged to the console. (ever worked on a console printing messages all the time to your screen? Here's how to fix that) Messages with a higher priority than console_loglevel will be printed to the console.
/proc/sys/kernel/pty
(since kernel 2.6.4)
This directory contains two files relating to the number of Unix 98 pseudo-terminals on the system.
/proc/sys/kernel/pty/max
Defines the maximum number of pseudo-terminals.
/proc/sys/kernel/pty/nr
This read-only file indicates how many pseudo-terminals are currently in use.
/proc/sys/kernel/random
This directory contains various parameters controlling the operation of the file /dev/random.
/proc/sys/kernel/real-root-dev
Used by the deprecated change_root initrd system
/proc/sys/kernel/rtsig-max
( until kernel 2.6.7)
Can be used to tune the maximum number of POSIX real-time (queued) signals that can be outstanding in the system.
/proc/sys/kernel/rtsig-nr
(until kernel 2.6.7)
This file shows the number POSIX real-time signals currently queued.
/proc/sys/kernel/sem
(since kernel 2.4)
Contains 4 numbers defining limits for System V IPC semaphores.
/proc/sys/kernel/sg-big-buff
Shows the size of the generic SCSI device (sg) buffer.
/proc/sys/kernel/shmall
Contains the system-wide limit on the total number of pages of System V shared memory.
/proc/sys/kernel/shmmax
This file can be used to query and set the run-time limit on the maximum (System V IPC) shared memory segment size that can be created.
/proc/sys/kernel/shmmni
(from kernel 2.4)
Specifies the system-wide maximum number of System V shared memory segments that can be created.
/proc/sys/kernel/version
Kernel version number and build date
/proc/sys/net
Networking information.
/proc/sys/net/core/somaxconn
Defines a ceiling value for the backlog argument of listen
/proc/sys/net/core/rmem_max
Maximum TCP Receive Window.
/proc/sys/net/core/wmem_maxx
Maximum TCP Send Window.
/proc/sys/net/ipv4/ip_forward
Enable or disable routing.
/proc/sys/sunrpc
This directory supports Sun remote procedure call for network file system (NFS).
/proc/sys/vm
This directory contains files for memory management tuning, buffer and cache management. One of the more interresting directories in proc sys as it allows manipulating memory handling in real time.
/proc/sys/vm/swappiness
(since kernel 2.6.16)
vm.swappiness takes a value between 0 and 100 to change the balance between swapping applications and freeing cache. At 100, the kernel will always prefer to find inactive pages and swap them out; in other cases, whether a swapout occurs depends on how much application memory is in use and how poorly the cache is doing at finding and releasing inactive items.
/proc/sys/vm/drop_caches
(since kernel 2.6.16)
Writing to this file causes the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
To free pagecache, write 1 to this file.
To free dentries and inodes, write 2 to this file.
To free pagecache, dentries and inodes, write 3 to this file.
Just try echo 1 > /proc/sys/vm/drop_caches, and watch your memory usage drop by all kernel cache memory.
/proc/sys/vm/legacy_va_layout
(since kernel 2.6.9)
If non-zero, this disables the new 32-bit memory-mapping layout; the kernel will use the legacy (2.4) layout for all processes.
/proc/sys/vm/oom_dump_tasks
(since kernel 2.6.25)
Enables a system-wide task dump (excluding kernel threads) to be produced when the kernel performs an OOM-killing. The dump includes the following information for each task (thread, process): thread ID, real user ID, thread group ID (process ID), virtual memory size, resident set size, the CPU that the task is scheduled on, oom_adj score (see the description of /proc[number]/oom_adj), and command name. This is helpful to determine why the OOM-killer was invoked and to identify the rogue task that caused it.
If this contains the value zero, this information is suppressed.
It defaults to 0, so if you have a problem requiring it, enable it :
echo 1 > /proc/sys/vm/oom_dump_tasks
/proc/sys/vm/oom_kill_allocating_task
(since kernel 2.6.24)
This enables or disables killing the OOM-triggering task in out-of-memory situations. If this is set to zero, the OOM-killer will scan through the entire tasklist and select a task based on heuristics to kill. This normally selects a rogue memory-hogging task that frees up a large amount of memory when killed.
If this is set to non-zero, the OOM-killer simply kills the task that triggered the out-of-memory condition. This avoids a possibly expensive tasklist scan.
If /proc/sys/vm/panic_on_oom is non-zero, it takes precedence over whatever value is used in /proc/sys/vm/oom_kill_allocating_task.
The default value is 0.
/proc/sys/vm/overcommit_memory
This file contains the kernel virtual memory accounting mode. Values are:
0: heuristic overcommit (default)
1: always overcommit, never check
2: always check, never overcommit
/proc/sys/vm/overcommit_ratio
Value used in calculating virtual address space
/proc/sys/vm/panic_on_oom
(since kernel 2.6.18)
This enables or disables a kernel panic in an out-of-memory situation.
0 (default) : no panic
1 : panic but not if a process limits allocations to certain nodes using memory
policies mbind or cpusets and those nodes reach memory exhaustion status.
2 : always panic