Linux job controls
My partner gave me my christmas present early, Daniel J. Barrett’s Efficient Linux at the Command Line, which I started diving into immediately.
I picked a page at random, covering the topic of job controls. Little did I know that once you run a job in the background, say for example using sleep 20 &
, you can view those running jobs with a dedicated command! Admittedley, I haven’t looked into job controls much other than initiating them, then viewing with ps
or top
, but you can view all running jobs with the conveniently named jobs
command.
% sleep 20 &
[1] 137735
% jobs
[1] + running sleep 20
Neat!
You can also bring that job to the foreground with the fg
command.
% fg
[1] + 137735 running sleep 20
You can do much more with jobs
[1], fg
[2] and bg
[3], worth looking into if you aren’t aware already.
All of this information is of course available for free online, however sometimes it’s nice to have a physical reference to look at from time to time!
[1] https://man7.org/linux/man-pages/man1/jobs.1p.html
[2] https://man7.org/linux/man-pages/man1/fg.1p.html
[3] https://man7.org/linux/man-pages/man1/bg.1p.html