Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Job control is probably my favorite thing about Linux. I find myself, often, starting a computationally demanding process that basically renders a computer unusable for up to days at a time, and being thankful that there is always CTRL-Z and fg, in case I need to use that particular computer during that particular time period.

Sometimes, however, I want to insert a job onto the job stack. I've never figured out how to do that.

I'm using bash.

It would probably look something like:

$ ./reallybigjob
[1]+  Stopped                 reallybigjob
$ (stuff I don't know) && ./otherbigjob
$ fg
share|improve this question
There is no "stack". Are you trying to "pause" reallybigjob, start otherbigjob, and have reallybigjob automatically "resume" when otherbigjob is done? – Mat Jan 28 '12 at 14:12
at (and atq) could be handy here, but I'm not entirely sure if two commands run at now run after each other... (some examples) – sr_ Jan 28 '12 at 14:14
I want to resume reallybigjob and enter otherbigjob immediately following the termination of reallybigjob. the same command would also allow me to add 100 jobs in a predetermined sequence, resume reallybigjob, then enter otherbigjob001, otherbigjob002, etc.. – ixtmixilix Jan 28 '12 at 15:33
Related: How can I queue processes? – Gilles Jan 28 '12 at 22:04
up vote 1 down vote accepted

There is no job stack, each job is handled independently.

You can do fg; otherbigjob. That will put reallybigjob back to the foreground, then when the fg command stops run otherbigjob. This isn't the same thing as queuing otherbigjob for execution after the first job: if you press Ctrl+Z then otherbigjob starts immediately. If you press Ctrl+C then reallybigjob is killed. You can't leave otherbigjob in the background and queue another job after it.

If the jobs are CPU-intensive, then the batch utility can let you schedule the next job when the CPU isn't busy.

share|improve this answer
a semicolon. how simple. i knew there would be a way to do the thing i needed to do. thank you. i will definitely also use batch at some point. – ixtmixilix Feb 2 '12 at 0:28

You can have more than one job running or paused in the background:

$ ./reallybigjob &
[1] 873
$ ./otherbigjob &
[2] 875
$ jobs
[1]-  Running                 ./reallybigjob &
[2]+  Running                 ./otherbigjob &
$ fg 1
[1]+  Stopped                 ./reallybigjob
$ fg 2
[2]+  Stopped                 ./otherbigjob
$ jobs
[1]-  Stopped                 ./reallybigjob
[2]+  Stopped                 ./otherbigjob
$bg 1
[1]- ./reallybigjob &
$ jobs
[1]-  Running                 ./reallybigjob &
[2]+  Stopped                 ./otherbigjob
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.