Home » Questions » Computers [ Ask a new question ]

How to end a program in an unix shell? [duplicate]

How to end a program in an unix shell? [duplicate]

On my laptop I press the laptop function key + break. On my desktop, my break key (next to print screen) is like this:

Asked by: Guest | Views: 71
Total answers/comments: 1
Guest [Entry]

"You can use Ctrl - C to end a program's execution in the terminal.

You can kill programs that have already been stopped with kill:

kill PID

where PID is the process id (the number you will see in ps output):

Python 2.4.3 (#1, Sep 17 2008, 16:04:01)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-41)] on linux
Type ""help"", ""copyright"", ""credits"" or ""license"" for more information.
[1]+ Stopped python
3560 pts/1 00:00:00 bash
3588 pts/1 00:00:00 python
3609 pts/1 00:00:00 ps

Using kill without any switches is the same as using -TERM. It will attempt to gracefully close the program. If it still does not respond you can forcefully kill it with kill -9, although not recommended as it may leave behind files from opened buffers."