How can I resume a stopped job in Linux?
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Cool Puzzler LoFi
--
Chapters
00:00 Question
00:26 Accepted answer (Score 503)
00:43 Answer 2 (Score 332)
01:50 Answer 3 (Score 53)
02:09 Answer 4 (Score 37)
02:33 Thank you
--
Full question
https://superuser.com/questions/268230/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #sh #jobcontrol
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Cool Puzzler LoFi
--
Chapters
00:00 Question
00:26 Accepted answer (Score 503)
00:43 Answer 2 (Score 332)
01:50 Answer 3 (Score 53)
02:09 Answer 4 (Score 37)
02:33 Thank you
--
Full question
https://superuser.com/questions/268230/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #sh #jobcontrol
#avk47
ACCEPTED ANSWER
Score 526
The command fg
is what you want to use. You can also give it a job number if there are more than one stopped jobs.
ANSWER 2
Score 350
The general job control commands in Linux are:
- jobs - list the current jobs
- fg - resume the job that's next in the queue
- fg %[number] - resume job [number]
- bg - Push the next job in the queue into the background
- bg %[number] - Push the job [number] into the background
- kill %[number] - Kill the job numbered [number]
- kill -[signal] %[number] - Send the signal [signal] to job number [number]
- disown %[number] - disown the process(no more terminal will be owner), so command will be alive even after closing the terminal.
That's pretty much all of them. Note the % infront of the job number in the commands - this is what tells kill you're talking about jobs and not processes.
ANSWER 3
Score 55
You can also type %<process_name>
; i.e., you hit Ctrl-Z in emacs, then you can type %emacs
in the console and bring it back to the foreground.
ANSWER 4
Score 37
Just to add to the other answers, bash lets you skip the fg
if you specify a job number.
For example, these are equivalent and resume the latest job:
%
%%
fg
fg %
These resume job #4:
%4
fg 4