you can use top
or ps
command to see all of your PID
and also you can use pidof
command to gain PID
for example I wanna check the PID
of bash
command so I will write :
pidof bash
or with ps
command you can write
ps -C bash
or with ps
and grep
you can write :
ps aux | grep bash
or just write top
and check what ever you need.
for sending a command to bg
or background
you have to add &
at the end of your command for example I wanna send xeyes
to bg
so I will write :
xeyes &
if you wanna bring it to foreground
or fg
you will write :
fg xeyes
you can also see all of your jobs with jobs -l
command.
for example I want to run xeyes
command so I will write :
xeyes
please attention to eyes when you moving your mouse, now if I want send it to bg
I can use CTRL+Z
on my keyboard.
if you want to check it you can write jobs
you will see xeyes
is stopped !
left of each process is a number like this :
[1]- 6331 Running xeyes &
[2]+ Stopped xeyes
for example for me is 2 you can start your PID again like this :
bg %2
or you can find PID
with -l
in jobs
to see PIDs
too
[1]- 6331 Running xeyes &
[2]+ 6332 Stopped xeyes
instead of bg %2
I can write bg 6332
to change state to Running !
and also you see +
or -
in this case, if the +
sign was next to that process is stoped you can just write bg without any this like this :
bg # attention to +
if you want to bring your command to fg
is exactly like bg
, which means you can use one of that ways that I already mentioned !
I think about your question, it means the process has received a STOP
signal, and won't do anything much until it receives a CONT
signal, not even terminate.
Actually the most common source of STOP
signals is the user hitting CTRL+Z
while the process is in the foreground
, and the common way to send a CONT
afterwards is typing fg
or bg
which continue the process in the foreground
and background
respectively, another way to send STOP
to a process is kill -STOP PID
. Similarly, CONT
can be sent to a process with kill -CONT PID
.
Since you sent TERM
signals to the processes, I assume you want them to terminate. For that to happen, the processes must receive CONT
signals. You can send those by typing kill -CONT 6331 6332
in a terminal window. please aware that these PIDs
is belong to me and you have to change it to yours !