On a typical linux machine you can change kernel configuration by modifying the files located at /proc/*.

For example, for the IPv6 accept_dad parameter of a specific network interface (say, eth0), you'd modify the following file:


But, as I recently discovered, there is the widely spread tool, sysctl, which has the same purpose, and works like so:

sysctl -w net.ipv6.conf.eth0.accept_dad=1

My question is, when should we use which tool? My instinct says that if you know what you're doing, you should write to file directly but, if you would like validations and what not, you should use sysctl.

Since sysctl is yet another layer over something that we can control directly, I think by using it we're exposing ourselves to potential bugs that are otherwise avoided by writing to files directly.


sysctl is a tool for reading and modifying various kernel attributes. It is available in many Unix-like operating systems, including not only Linux, but also OpenBSD and FreeBSD, for example. sysctl is typically available both as a shell command and as a system call.

In Linux, the sysctl mechanism is additionally exposed as part of the procfs virtual filesystem, under /proc/sys.

Note that the sysctl syscall is deprecated in Linux; it is recommended to use /proc/sys instead (either directly or via the sysctl shell command).


  • Manpage for the sysctl syscall in Linux
  • Manpage for the sysctl shell command in Linux

sysctl is a utility for interacting with /proc. In general, they accomplish the same thing. I would guess that years (decades?) ago, the only way to adjust kernel parameters was by editing the "files" in /proc by hand and sysctl came along later as a more civilized way of searching and modifying kernel params.

Of note, edits in /proc do not survive a reboot. This is handy if you are experimenting. The file /etc/sysctl.conf is a place to store your sysctl changes which you want to maintain across boot. If you really like editing the files instead, you may want to just make your changes there and call sysctl -p to execute the changes.

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.