3.6. Using job control (partial coverage)

Since it's now easy to open multiple terminals in either KDE or GNOME, job control (that is, handling multiple programs running simultaneously while being able to switch between them) is not as important as it used to be, when one terminal was all that was available. Thus, I will only cover how to kill (that is, terminate) a process (that is, a running program).

More information on processes and job control can be found in Barr, CLI for Noobies, Chapter 10 ("background, foreground, suspend"), and Garrels, Introduction to Linux, Chapter 4 ("Processes"), particularly Section 1 ("Processes Inside Out").

Example 3.12. Using ps and kill[34]

[jg18@grid ~]$ ps -u jg18

  PID TTY          TIME CMD
21947 ?        00:00:00 sshd
21948 pts/6    00:00:00 tcsh
23482 pts/6    00:00:00 vim
23484 pts/6    00:00:00 ps
        

[jg18@grid ~]$ kill -9 23482

[1]    Killed                        vim
        


Table 3.8. Commands for terminating a process

CommandAction

ps [-u user]

List running processes with their process IDs [only those from the specified user]

kill -9 process_ID

Kill (end) the specified process



[34] I could also use grep (discussed in Section 3.5, “Working with text streams”) here: If I know the name (or part of the name) of the process that I want to terminate (in this case, vim), I could find its PID quickly by typing ps -u jg18 | grep vim.


Back to Guide main page