Hack 99. Sysctl Command Examples

by Ramesh

Linux kernel parameter can be changed on the fly using sysctl command. Sysctl helps to configure the Linux kernel parameters during runtime.

  1. # sysctl –a
  2.  
  3. dev.cdrom.autoclose = 1
  4. fs.quota.writes = 0
  5. kernel.ctrl-alt-del = 0
  6. kernel.domainname = (none)
  7. kernel.exec-shield = 1
  8. net.core.somaxconn = 128
  9. net.ipv4.tcp_window_scaling = 1
  10. net.ipv4.tcp_wmem = 4096 16384 131072
  11. net.ipv6.route.mtu_expires = 600
  12. sunrpc.udp_slot_table_entries = 16
  13. vm.block_dump = 0

Modify Kernel parameter in /etc/sysctl.conf for permanent change

After modifying the kernel parameter in the /etc/sysctl.conf, execute sysctl –p to commit the changes. The changes will still be there after the reboot.

  1. # vi /etc/sysctl.conf
  2.  
  3. # sysctl –p

Modify kernel parameter temporarily

To temporarily modify a kernel parameter, execute the following command. Please note that after reboot these changes will be lost.

  1. # sysctl –w {variable-name=value}