This week we are controlling the processes that we learned about last week.
Last week we discussed processes- what they are and how to view them. Now, let’s control those. Let’s open the program called gedit- a text editing program. You’ll notice your shell prompt will not return until the program is closed. Press CTRL-C to interrupt the program (or terminate). This works for most command-line programs but not all.
Now run gedit again with an & at the end. This says we started job number 1, with a PID of 3853. Running ps shows the proccess as well. If you type jobs, this will also show you that gedit is running. (one job, number 1, command gedit &).
To return the process to the foreground from the terminal, type jobs to find the number, then fg %1. To terminate again, press CTRL-C.
Type CTRL-Z to completely stop a process. So if gedit is running, then type CTRL-Z to stop or pause it. You can restore the program with fg, or move it to the background with bg (bg %1). The number is…