Awesome!
Ever had that you were building (/emerging/casting) something, but thought of more during the build? You can put the commands behind the running command by:
1. Press Control+Z, the process is paused
2. Run "fg ; command(s) you want to run"
Beware though, once you press Control+Z again, the new commands start running so this only works once and you have to leave the process alone for the rest of the time.
Sam
Awesome!
See also 'jobs', to list those stopped jobs, and 'bg', to put the process in the background.
Yeah. Good idea to check jobs before doing the fg command as well, just in case you have something else backgrounded. Then you can fg by job nuumber.
A kind of short summary for % usage:
Ctrl+Z: Pause and send to background.
jobs: List background processes.
%n: take the n'th process in `jobs` to foreground.
%n &: load n'th process (in `jobs`) in the background (a kind of resume to Ctrl+Z pause.)
When you want to resume a process in the background with &, sometimes it also dumps its output to foreground too. To escape from this situation you can run process as a child proc. (which we call as double penatration
it's sth. like that:
# first try this:
> mplayer mudvayne.mp3 &
# or
> mplayer mudvayne.mp3 & 1> /dev/null 2>&1
# as you'll see, it dumps its output to stdout.
# stop above process and this time try this:
> { mplayer mudvayne.mp3 & } 1> /dev/null 2>&1 &
# but this time mplayer isn't listed in the `jobs`
# it appears as a child process in `ps` output.
for more information about this, you can take a look at ABS (advanced bash scripting) guide. (also, i should take a look at too![]()
Bookmarks