Run Scripts on Background (Linux)

Run a script in the background by appending an & to the end of a command, for instance:

$> ./slow_script.pl &

If you run a script and forgot to append the &. You can hit Ctrl+Z to pause the process that is currently running, and give you a shell. Then type bg to send that process into the background. To see how its doing, you can use the jobs command. To send it back into the foreground you can use the fg command.

So for example you might do something like this:

$> ./slow_script.pl
hits Ctrl+Z
[1]+ Stopped ./some_slow_script.pl
$>
$> bg
[1]+ ./some_slow_script.pl &
$> jobs
[1]+ Running ./some_slow_script.pl &
$> jobs
[1]+ Done ./some_slow_script.pl
 

About

Search

PISIKA Copyright © 2009