`jobs` command doesn't show any background processes
Solution 1:
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.
Solution 2:
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.