Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is there any reason to use sysctl over "echo > /proc" or is it just a matter of taste?


Well, you can put your changes in /etc/sysctl.conf instead of coming up with a homegrown script to do a whole bunch of echos.

For me, I can just copy over a modified sysctl.conf to a server and have such changes applied (reboot may be needed).


For loonix only sysctl's I guess it would be a matter of taste; however, if you want to keep your muscle memory strong for operating systems lacking full /proc support, you might prefer the sysctl command.


"sudo sysctl -w ..." works as expected, but "sudo echo ...> /proc/..." doesn't, since only the echo and not the redirection happens as root.


That depends on what you expect, doesn't it? At any rate, you can easily do something like

echo 1 | sudo tee /proc/foo

This has the added bonus that you can replace "echo 1" with a complex script that may not be safe to run as root.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: