I bought a raspberry and I defined it to run a auto program in the boot by changing the rc.local. The problem is that the program is running and ctr+c doesn't work. There is a way to stop the program during it is running? There is a way to edit rc.local and fix it?


You can, of course, edit rc.local to remove that entry again. However that is not going to stop the running instance of that program, it just prevents that it is started again after the next reboot.

To stop that program do the following:

Run ps aux | grep <your-program's-name-here> (the listed example used ps aux | grep mopidy). You'll get a result like this

pi   280  0.0 19.4 218896 146148 ?       Sl   Apr09   0:54 /usr/bin/python2 /usr/bin/mopidy
pi 10052  0.0  0.0   2644   500 pts/0    S+   21:26   0:00 grep mopidy

The number after pi (which is the user running the program) is the so called PID - a unique number identifying the running program. Use that number to issue this command to stop it from running: kill -TERM <PID> or if it still resists kill -KILL <PID>. In the example above that translates to kill -TERM 280 (see man kill).

If installed you might also want to use killall which kills processes by name (see man killall).

  • Try Ctrl + Alt + F1 to F6 for another virtual console to enter the commands.
    – Ghanima
    Apr 18 '16 at 19:49
  • Just in case, do you know how can I reach to rc.local?
    – Sussman
    Apr 18 '16 at 19:53
  • Open /etc/rc.local in your favourite command line based text editor, e.g. nano /etc/rc.local
    – Ghanima
    Apr 18 '16 at 19:56
  • ... and by the way, check raspberrypise.tumblr.com for hints and tricks, e.g. concerning the command line.
    – Ghanima
    Apr 18 '16 at 19:57

I highly recommend this as a guide to creating an automatically running daemon which you can start and stop from the commandline:


It's a simple matter of cutting and pasting the script and 3 tiny modifications.

  • Come on, that response is totally worth a "useful".
    – KDM
    Apr 22 '16 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.