sysctl vs writing directly to /proc/*
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).
References:
- Manpage for the
sysctl
syscall in Linux - Manpage for the
sysctl
shell command in Linux