Adult web hosting - 264 CHAPTER 16 TAKING CONTROL OF THE
264 CHAPTER 16 TAKING CONTROL OF THE SYSTEM CLEARING UP CRASHES Sometimes, a crashed process can cause all kinds of problems. The shell you re working at may stop working, or the GUI itself might stop working properly. In cases like this, it s important to remember that you can have more that one instance of the command- line shell up and running at any one time. For example, if a process crashes and locks up GNOME Terminal, simply start a new instance of GNOME Terminal (Applications . Accessories . Terminal). Then use top within the new window to kill the process that is causing trouble for the other terminal window. If the crashed program affects the entire GUI, you can switch to a virtual console by pressing Ctrl+Alt+F1. Although the GUI disappears, you will not have killed it, and no programs will stop running. Instead, you ve simply moved the GUI to the background while a shell console takes over the screen. Then you can use the virtual console to run top and attempt to kill the process that is causing all the problems. When you re ready, you can switch back to the GUI by pressing Ctrl+Alt+F7. Controlling Jobs Whenever you start a program at the shell, it s assigned a job number. Jobs are quite separate from processes and are designed primarily for users to understand what programs are running on the system. You can see which jobs are running at any one time by typing the following at the shell prompt: jobs When you run a program, it usually takes over the shell in some way and stops you from doing anything until it s finished what it s doing. However, it doesn t have to be this way. Adding an ampersand symbol (&) after the command will cause it to run in the background. This is not much use for commands that require user input, such as vior top, but it can be very handy for commands that churn away until they re completed. For example, suppose that you want to decompress a large zip file. For this, you can use the unzipcommand. As with Windows, decompressing large zip files can take a lot of time, during which time the shell would effectively be unusable. However, you can type the following to retain use of the shell: unzip myfile.zip & When you do this, you ll see something similar to the following, although the four-digit number will be different: [1] 7483 This tells you that unzip is running in the background and has been given job number 1. It also has been given process number 7483 (although bear in mind that when some programs start, they instantly kick off other processes and terminate the one they re currently running, so this won t necessarily be accurate).