Welcome to the most active Linux Forum on the web.
Go Back > Blogs > Notes on Linux
User Name


I leave notes here that I find particularly worth remembering myself.
Rate this Entry

Unix runlevel scripts: Finally the first character makes sense!

Posted 05-29-2010 at 04:12 PM by bittner

You probably know Unix runlevel scripts. They start with an S or a K, and they are typically located at /etc/rcX.d/ with X being the runlevel (0-6) the script is supposed to run at. For example:
~$ ls -l /etc/rc5.d/*cups
lrwxrwxrwx 1 root root 14 2009-12-31 16:35 /etc/rc5.d/S50cups -> ../init.d/cups
To be precise those S- and K- files are typically symbolic links to scripts that reside in /etc/init.d/, and from my experience I felt they work as follows:
  • Any symlink starting with an S will result in the script it points to to be executed with the parameter "start"
  • Any symlink starting with a K will result in the script it points to to be executed with the parameter "stop"
If you administer your Linux system on the console you know that, because you're not the only one who starts/stops or reloads Apache with a "/etc/init.d/apache stop" (or the like) on your webserver. But that's what kept me puzzled for the last couple of years obviously, because I couldn't imagine what K would have to do with stop. Anyway, I didn't bother too much. Just one of the lots of things you don't know about a complex operating system, whatever!

A couple of weeks ago, though, I found this out:
  • S ... means "start"
  • K ... means "kill"
... when the system enters the respective runlevel. (Source:

Oh my gosh, finally the answer to my question (I never asked) found me! The K is the "kill", which is definitely not so different from the "stop". But of course: You can't use S to "stop" too when you use it for "start" already...

I could have read the manuals earlier, probably...
Posted in Uncategorized
Views 3094 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 07:31 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration