|
Managing your current jobs in the stackLast revision August 9, 2004
Several C-shell commands allow you to affect the jobs in the stack.
For example, if you needed to move a large directory with many files to the scratch disk and you started that with a mv command. But if you became impatient and needed to check something else, you could suspend it with CTRL-Z. Next, you could open an on-line manual page, and then suspend it. Finally, you could start a vi editor session and then suspended it. Running the jobs command shows these three suspended jobs in your stack:
pangea> jobs With no arguments, kill, fg, and bg affect the current job in the stack. The current job is the one indicated by a + sign in the output of the jobs command. In the example above, the current job is the vi job, and you can resume it (bring it back into the foreground) with the command fg In general, the current job will be the most recently suspended one. To affect a suspended job that is not the current job, you give its job number to the kill, fg, or bg commands as an argument in the form %n, where n is the job number (from the output of the jobs command). In the example above, kill %2 will kill the suspended man job without bothering to resume it. If you try to logout from your current session when there are suspended jobs, the shell will warn you and will not immediately logout. Kill the suspended jobs first, or start them going again in the background, and then logout. In the example above, you can just push the mv job into the background and let it finish even after you have logged out, because it does not need any input or output to the terminal. You would do that with the command bg %3
|