查看进程状态:
命令:
ps -ef;
ps -aux;
ps -ef | grep (进程名):只查看指定进程名进程的状态
pgrep (进程名):查看指定进程名进程状态
pkill -9 (进程名):杀死指定进程名进程
kill -s 9 (进程号):-s 9 制定了传递给进程的信号是9,即强制、尽快终止进程。
killall -9 (进程名):杀死指定进程名进程。(如果给出的进程名不完整,killall会报错。pkill或者pgrep只要给出进程名的一部分就可以终止进程)
各种信号及其用途:
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 |