linux下杀死进程(kill)的N种方法

标签:
计算机 |
分类: 百宝箱 |
$ ps
-ef
……
smx
1822
1 0 11:38 ?
00:00:49 gnome-terminal
smx
1823
1822 0 11:38 ?
00:00:00 gnome-pty-helper
smx
1824
1822 0 11:38 pts/0
00:00:02 bash
smx
1827
1 4 11:38 ?
00:26:28
/usr/lib/firefox-3.6.18/firefox-bin
smx
1857
1822 0 11:38 pts/1
00:00:00 bash
smx
1880
1619 0 11:38 ?
00:00:00 update-notifier
……
smx
11946
1824 0 21:41 pts/0
00:00:00 ps -ef
$ ps
-aux
……
smx
1822
0.1 0.8 58484
18152 ?
Sl 11:38
0:49 gnome-terminal
smx
1823
0.0 0.0 1988
712 ?
S
11:38 0:00
gnome-pty-helper
smx
1824
0.0 0.1 6820
3776 pts/0
Ss 11:38
0:02 bash
smx
1827
4.3 5.8 398196 119568 ?
Sl
11:38 26:13
/usr/lib/firefox-3.6.18/firefox-bin
smx
1857
0.0 0.1 6688
3644 pts/1
Ss 11:38
0:00 bash
smx
1880
0.0 0.6 41536
12620 ?
S 11:38
0:00 update-notifier
……
smx
11953
0.0 0.0 2716
1064 pts/0
R+ 21:42
0:00 ps -aux
$ kill -s 9
1827
$ ps -ef | grep
firefox
smx
1827
1 4 11:38 ?
00:27:33
/usr/lib/firefox-3.6.18/firefox-bin
smx
12029
1824 0 21:54 pts/0
00:00:00 grep --color=auto
firefox
$kill -s 9
1827
$ pgrep
firefox
1827
$kill -s 9
1827
$ pidof
firefox-bin
1827
$kill -s 9
1827
$ps -ef | grep
firefox | grep -v grep | cut -c 9-15 | xargs kill -s 9
$ pgrep firefox
| xargs kill -s 9
$ ps -ef | grep
firefox | awk '{print $2}' | xargs kill -9
kill: No such
process
$kill -s 9 `ps
-aux | grep firefox | awk '{print $2}'`
$kill -s 9
`pgrep firefox`
$pkill -9
firefox
$killall -9
firefox
Signal
Description Signal number on Linux x86[1]
SIGABRT Process
aborted 6
SIGALRM Signal
raised by alarm 14
SIGBUS Bus
error: "access to undefined portion of memory object"
7
SIGCHLD Child
process terminated, stopped (or continued*) 17
SIGCONT
Continue if stopped 18
SIGFPE Floating
point exception: "erroneous arithmetic operation" 8
SIGHUP Hangup
1
SIGILL Illegal
instruction 4
SIGINT
Interrupt 2
SIGKILL Kill
(terminate immediately) 9
SIGPIPE Write
to pipe with no one reading 13
SIGQUIT Quit
and dump core 3
SIGSEGV
Segmentation violation 11
SIGSTOP Stop
executing temporarily 19
SIGTERM
Termination (request to terminate) 15
SIGTSTP
Terminal stop signal 20
SIGTTIN
Background process attempting to read from tty ("in")
21
SIGTTOU
Background process attempting to write to tty ("out")
22
SIGUSR1
User-defined 1 10
SIGUSR2
User-defined 2 12
SIGPOLL
Pollable event 29
SIGPROF
Profiling timer expired 27
SIGSYS Bad
syscall 31
SIGTRAP
Trace/breakpoint trap 5
SIGURG Urgent
data available on socket 23
SIGVTALRM
Signal raised by timer counting virtual time: "virtual timer
expired" 26
SIGXCPU CPU
time limit exceeded 24
SIGXFSZ File
size limit exceeded 25