Training

When: Every first Sunday of every month -get a ticket- from $15 (Click Here).

Friday, November 3, 2017

shell - There are stopped jobs (on bash exit) - Unix & Linux Stack Exchange

A stopped job is one that has been temporarily put into the
background and is no longer running, but is still using resources such
(i.e. system memory). Because that job is not attached to the current
terminal, it cannot produce output and is not receiving input from the
user.





You can see jobs you have running using the jobs builtin command in bash, probably other shells as well. Example:



user@mysystem:~$ jobs
[1] + Stopped                python
user@mysystem:~
 
You can resume a stopped job by using the fg
(foreground) bash built-in command. If you have multiple commands that
have been stopped you must specify which one to resume by passing
jobspec number on the command line with fg. If only one program is stopped, you may use fg alone:



user@mysystem:~$ fg 1
python


At this point you are back in the python interpreter and may exit by using control-D.



Conversely, you may kill the command with either it's jobspec or PID. For instance:



user@mysystem:~$ ps
  PID TTY          TIME CMD
16174 pts/3    00:00:00 bash
17781 pts/3    00:00:00 python
18276 pts/3    00:00:00 ps
user@mysystem:~$ kill 17781
[1]+  Killed                  python
user@mysystem:~$ 


To use the jobspec, precede the number with the percent (%) key:



user@mysystem:~$ kill %1
[1]+  Terminated              python






shell - There are stopped jobs (on bash exit) - Unix & Linux Stack Exchange

No comments: