How to reload sysctl.conf variables on Linux

4.6
(9)

The sysctl command is used to modify Linux kernel variables at runtime. The variables are read and write from /proc/sys/ location using procfs. The syntax is as follows for to define variable:

variable=value

Read variable from command line

$ sysctl kernel.ostype

To see all variables pass the -a option:

$ sysctl -a
$ sysctl -a | grep kernel
$ sysctl -a | more

Sample outputs:

abi.vsyscall32 = 1
crypto.fips_enabled = 0
debug.exception-trace = 1
debug.kprobes-optimization = 1
dev.hpet.max-user-freq = 64
dev.mac_hid.mouse_button2_keycode = 97
dev.mac_hid.mouse_button3_keycode = 100
dev.mac_hid.mouse_button_emulation = 0
dev.raid.speed_limit_max = 200000
dev.raid.speed_limit_min = 1000
dev.scsi.logging_level = 0
fs.aio-max-nr = 65536
fs.aio-nr = 5352
fs.binfmt_misc.status = enabled
fs.dentry-state = 1076563	1034844	45	0	0	0
fs.dir-notify-enable = 1
fs.epoll.max_user_watches = 418058
fs.file-max = 204059
fs.file-nr = 1664	0	204059
fs.inode-nr = 280530	70402
fs.inode-state = 280530	70402	0	0	0	0	0
fs.inotify.max_queued_events = 16384
fs.inotify.max_user_instances = 128
fs.inotify.max_user_watches = 8192
fs.lease-break-time = 45
fs.leases-enable = 1
fs.mqueue.msg_default = 10
fs.mqueue.msg_max = 10
fs.mqueue.msgsize_default = 8192
fs.mqueue.msgsize_max = 8192
fs.mqueue.queues_max = 256
fs.nfs.nfs_congestion_kb = 45760
fs.nfs.nfs_mountpoint_timeout = 500
fs.nfs.nlm_grace_period = 0
fs.nfs.nlm_tcpport = 0
fs.nfs.nlm_timeout = 10
.....
..
..
vm.page-cluster = 3
vm.panic_on_oom = 0
vm.percpu_pagelist_fraction = 0
vm.scan_unevictable_pages = 0
vm.stat_interval = 1
vm.swappiness = 60
vm.user_reserve_kbytes = 63568
vm.vfs_cache_pressure = 100
vm.zone_reclaim_mode = 0

Write variable from command line

The syntax is:

# sysctl -w variable=value

To enable packet forwarding for IPv4, enter:

# sysctl -w net.ipv4.ip_forward=1

Reload settings from all system configuration files

Type the following command to reload settings from config files without rebooting the box:

# sysctl --system

The settings are read from all of the following system configuration files:

  1. /run/sysctl.d/*.conf
  2. /etc/sysctl.d/*.conf
  3. /usr/local/lib/sysctl.d/*.conf
  4. /usr/lib/sysctl.d/*.conf
  5. /lib/sysctl.d/*.conf
  6. /etc/sysctl.conf

Persistent configuration

You need to edit the /etc/sysctl.conf file for setting system variables:

# vi/nano/mcedit /etc/sysctl.conf

Modify or add in the file. Close and save the file. To Load in sysctl settings from the file specified or /etc/sysctl.conf if none given, enter:

# sysctl -p

Similar Posts:

16,718

How useful was this post?

Click on a star to rate it!

Average rating 4.6 / 5. Vote count: 9

No votes so far! Be the first to rate this post.

2 thoughts on “How to reload sysctl.conf variables on Linux”

  1. as a result of the interference of light reflected from the environment and the recesses

    Hello, Neat post. There is a problem with your website in web explorer, may check this?
    IE still is the market chief and a large part of other people
    will omit your wonderful writing because of this problem.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top