As the Linux kernel developed over time, developers sought a way to fine-tune some of the kernel parameters. Before sysctl, those parameters had to be changed in the kernel configuration and then the kernel had to be recompiled.
The sysctl command can change some parameters of a running kernel. It does this through the /proc file system, which is a "virtual window" into the running kernel. Although it might appear that a group of directories and files exist under /proc, that is only a representation of parts of the kernel. When we're the root user (or using the sudo command), we can read values from and write values to those "files," referred to as variables. We can display a list of the variables as shown in the following. (An annotated list is presented because roughly 250 items [or more] exist in the full list.)
net.ipv4.tcp_max_syn_backlog = 102 4 net.ipv4.tcp_rfc1337 = 0 net.ipv4.tcp_stdurg = 0 net.ipv4.tcp_abort_on_overflow = 0 net.ipv4.tcp_tw_recycle = 0 net.ipv4.tcp_syncookies = 0 net.ipv4.tcp_fin_timeout = 60 net.ipv4.tcp_retries2 = 15 net.ipv4.tcp_retries1 = 3 net.ipv4.tcp_keepalive_intvl = 75 net.ipv4.tcp_keepalive_probes = 9 net.ipv4.tcp_keepalive_time = 7200 net.ipv4.ipfrag_time = 3 0
The items shown are networking parameters, and actually tweaking these values is beyond the scope of this book. If we wanted to change a value, however, the -w parameter is used:
# sysctl -w net.ipv4.tcp_retries 2=20
This increases the value of that particular kernel parameter.
If you find that a particular setting is useful, you can enter it into the /etc/sysctl.conf file. The format is as follows, using the earlier example:
net.ipv4.tcp_retries 2=2 0
Of more interest to kernel hackers than regular users, sysctl is a potentially powerful tool that continues to be developed and documented.
The kernel does a good job of balancing performance for graphical systems, so there's not a great deal you can do to tweak your desktop to run faster.
Both GNOME and KDE are "heavyweight" desktop systems: They are all-inclusive, all-singing, and all-dancing environments that do far more than browse your file system. The drawback to this is that their size makes them run slow on older systems. On the flip side, Ubuntu also comes with the Xfce desktop, which is a great deal slimmer and faster than the other two. If you find GNOME and KDE are struggling just to open a file browser, Xfce is for you.
Was this article helpful?