3.7. Using job control

[Note]Note

Since job control is an important component of making effective use of the Linux CLI over SSH, this section is undergoing revisions to better accommodate the needs of SSH users. If you absolutely require authoritative information on job control at this time, or if you need to know more than just how to kill a process, I suggest that you try Machtelt Garrels's Introduction to Linux, specifically Section 1 (“Processes Inside Out”).

[will need rewrites!]For users who are using a computer, since it's easy to open multiple terminals, all the job control skills you really need are to terminate a process. For those using SSH, however, TODO

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.13. Using ps and kill[33]

[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.9. 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 with id of process_ID



[33] 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