`jobs` command doesn't show any background processes
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Romantic Lands Beckon
--
Chapters
00:00 `Jobs` Command Doesn'T Show Any Background Processes
00:43 Answer 1 Score 22
01:29 Accepted Answer Score 10
02:05 Thank you
--
Full question
https://superuser.com/questions/607218/j...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #bash
#avk47
ANSWER 1
Score 22
This is because jobs
shows background commands started from (belonging to) the same shell. The shell processes running under your desktop terminal and under ssh terminal are different.
See http://www.gnu.org/software/bash/manual/html_node/Job-Control-Basics.html
To be able to control your processes as jobs from different terminals you can use screen
or tmux
which are basically virtual terminal managers and can re-connect them to any number of other terminals.
For example, with screen
you just start it, it opens your default shell and you work with it as you would with any other shell. Then when you get home and ssh to your office machine, you can run screen -d -r
to detach the virtual terminal from your office desktop terminal and attach it to your ssh terminal, resuming the work. You can detach the virtual terminal from within screen
itself by pressing Ctrl-A, d.
ACCEPTED ANSWER
Score 10
Based on the problem statement of the question, IMHO I do not see any reason for using background
or foreground
. All you care is to find a process which is running in background so that you can kill it.
Run ps -ef | grep parameter3
to find processes which has parameter3
in the process name. You can adapt the grep
to uniquely identify a process, given you don't have two processes with exactly same process name.
Once you have it, just do kill -9 PID
and that process will be killed. So no need for bringing that process to the foreground for killing it.
Hope this helps.