For example running a background process:
# python server.py &
Method 1: use jobs command
[root@localhost project]# jobs
[1]+ Running python server.py &
[root@localhost project]# kill %1
[root@localhost project]# jobs
[1]+ Terminated python server.py
Method 2: use ps command
[root@localhost project]# ps aux | grep server.py
root 1244 0.0 0.8 11068 4312 pts/0 S 16:47 0:00 python server.py
root 1246 0.0 0.1 4356 740 pts/0 S+ 16:47 0:00 grep server.py
[root@localhost project]# kill -9 1244
Method 3: use fg to bring a background job back to foreground.
[root@localhost project]# jobsCopyright by: www.linuxoperatingsystem.info http://goo.gl/kMscJ4
[1]+ Running python server.py &
[root@localhost project]# fg 1
python server.py
^C
0 comments:
Post a Comment