Welcome to the Linux Foundation Forum!

Practical use of sysctl

I got a general question about sysctl. I understand how I can view and change kernel parameters but I'm struggling to think of parameters I might want to tweak. The video in chapter 25 shows how to change kernel.pid_max but that doesn't seem particularly useful (on my Fedora PC it's set to 4194304, which seems more than enough).

I looked into kernel.ctrl-alt-del and kernel.hostname. On my system kernel.ctl-alt-del is set to 0, which means the Ctrl-Alt-Del behaviour is managed by the init system. Changing the value to 1 didn't change its behaviour.

Next, I permanently changed my system's hostname by adding a file under /etc/sysctl.d/. This worked, and I was very proud of myself. However, when I cat /etc/hostname I am still seeing the old hostname. That makes me wonder why I would want change the hostname via sysctl. Simply updating /etc/hostname seems the right way to do this.

In short, I'm looking for some practical examples. Do any of you use sysctl to tweak settings?

Comments

  • coop
    coop Posts: 916

    There are many parameters that include memory management and also networking properties. Take a look in /proc/sys/vm and /proc/sys/net/ipv4 for example. On my system there are over 900 entries in /proc/sys :)

  • Beepie
    Beepie Posts: 2

    Thanks for the quick response. I think you are the gentleman in the video? (I'm sure I've seen the user name coop in one of the videos).

    I've dived into /proc/sys/vm/swappiness and it's al starting to sink in now, so thanks again for your reply.

  • coop
    coop Posts: 916

    yes that's me. I'm a little older than the avatar image here :)

Categories

Upcoming Training