1、top方法
ps -ef|grep 流程名称或流程号
top -H -p 进程号
2、ps 方法
ps -T -p 进程号
3、pstree
pstree -Aup -h pid
4、Htop
需要安装Htop
二、杀死某个过程的线程(未找到相关方法)
1、lsof 方法
lsof -iTCP |grep ip
列出某个ip的tcp链接,查出pid,并杀掉
2.杀死僵尸的过程
检查僵死过程:
ps-A-ostat,ppid,pid,cmd|grep-e'^[Zz]'
杀掉
kill -9 pid
自动查杀僵死过程指令:
ps-A-ostat,ppid,pid,cmd|grep-e'^[Zz]'|awk'{print$2}'|xargskill-9
附录:各种信号及用途
Signal | Description | Signal number on Linux x86[1] |
---|---|---|
SIGABRT | Process aborted #进程中止 | 6 |
SIGALRM | Signal raised byalarm #报警信号 | 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") #试图从tty读取数据的后台过程(in”) | 21 |
SIGTTOU | Background process attempting to write to tty ("out") #试图写入tty后台过程(out”) | 22 |
SIGUSR1 | User-defined 1 #用户自定义1 | 10 |
SIGUSR2 | User-defined 2 #用户自定义2 | 12 |
SIGPOLL | Pollable event #可投票事件 | 29 |
SIGPROF | Profiling timer expired #仿形计时器过期 | 27 |
SIGSYS | Badsyscall #系统调用不好 | 31 |
SIGTRAP | Trace/breakpointtrap #跟踪/断点陷阱 | 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 |