Questions about the various ways jobs can be controlled by the shell: suspending, resuming, terminating execution etc.
Questions tagged [job-control]
225 questions
11
votes
4 answers
How can I move a process into the background and also silence its output?
Say I start a process in the terminal and it sends output to standard error while it runs. I want to move the process into the background and also silence it at the same time.
Is there a way to do this without stopping the process and starting it…

dan
- 4,077
- 5
- 27
- 34
7
votes
1 answer
Stopped (ctrl z) process will not restart, and no longer in job list
I was running apt upgrade, when I needed the terminal, so did a ctrlz. When I tried to restart it (fg), it would not restart, because it was no-longer in the jobs list (jobs). (I Did not, run disown). I then did a ps to get process id. It showed the…

ctrl-alt-delor
- 27,993
6
votes
1 answer
What does "fg" stand for?
There is no manual entry for ctrl-z or fg.
What does "fg" stand for in the context of job control? In other words, typing ctrl-z will suspend the current job drop me back into the shell, and the command "fg" re-activates the suspended job. What…

Tyler Durden
- 5,631
4
votes
0 answers
Why doesn't putting elinks in background and then resuming with `fg` work reliably?
The elinks program takes over the terminal to let you browse the web. But its behavior in the context of job control is wonky.
If I CTRL-Z suspend an elinks session, and then try to resume it with fg, it works.
If I CTRL-Z suspend an elinks…

dan
- 4,077
- 5
- 27
- 34
3
votes
1 answer
Assign job number to background process by hand
Let's say I send two jobs to the background.
$ sleep 77 &
$ sleep 99 &
Then I check my jobs
$ jobs
> [1] - running sleep 77
> [2] + running sleep 99
Can I control what job number gets assigned to these jobs? I'm not sure if I'm using the…

pfnuesel
- 5,837
3
votes
2 answers
What would stop a task from being run in the background?
I have a script I'm trying to launch with
php ./Script.php &
The task goes into the background but it is stopped. When I try to run it with bg it simply stays stopped.
$ jobs
[1]+ Stopped php ./Script.php
$ bg
[1]+ php…

chugadie
- 158
2
votes
1 answer
Force a process to ignore/discard accumulated input while suspended?
So I've got an SSH reverse tunnel open, and I'm using tail to pipe the output of the sshd log into awk to detect certain login events and trigger an action. It looks like this:
ssh -NR 2222:127.0.0.1:22 server &
tail -fn 0 /var/log/auth.log | \
awk…

Ryan Lue
- 1,076
2
votes
0 answers
why did a local crash kill my remote jobs?
Yesterday I made an interesting observation. I sit on my local office computer (Ubuntu 16.04) and I have several remote jobs (long CFD simulations) on our cluster (CentOS7) running. All jobs were started as background jobs (program OPTIONS > LOGFILE…

Dohn Joe
- 215
1
vote
1 answer
why does kill work differently on job numbers than PIDs?
I was trying to demonstrate job control to a friend, when I ran into an unexpected behaviour. For certain commands, kill works with the job number, but not with the process ID.
An example of the bahaviour I expected:
user@host:~$ sleep 1h &
[1]…

ajhlinuxuser
- 67
1
vote
2 answers
What is the real-world use of the bg command?
This is the output:
[USER@SERVER ~] ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.037 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.024 ms
64 bytes…

LanceBaynes
- 40,135
- 97
- 255
- 351
1
vote
1 answer
Replacement queue now that batch doesn't accept input files?
Background
I work at a research institute, and have for a long time used the batch command to submit job queues to our machines. However, a recent update changed the batch command to be POSIX-compliant, the result of which is it doesn't take input…

Jonathan E. Landrum
- 227
- 4
- 15
0
votes
1 answer
Is a pure number like "3" a valid jobspec?
I was reading a book about Linux. It states that to bring a process to foreground, use the fg command and a percent sign (%) followed by the job number. I did some testing and found that it works as expected. But I also found that I can use a simple…

Fajela Tajkiya
- 1,005