linux查看进程与线程数
2015-11-04 11:07
656 查看
1. 查看进程:ps -ef 或 ps -aux
2.根据进程号进行查询:
# pstree -p 进程号
# top -Hp 进程号
3.根据进程名字进行查询:
# pstree -p `ps -e | grep server | awk '{print $1}'`
# pstree -p `ps -e | grep server | awk '{print $1}'` | wc -l
4.查看线程数
需要得到线程的PID
5. 进程启动时间(运行多长时间)
ps -eo lstart 启动时间
ps -eo etime 运行多长时间.
ps -eo pid,lstart,etime | grep 5176
得到进程的pid: 如: ps -ef | grep process_name | grep -v "grep" | awk '{print $2}'
2.根据进程号进行查询:
# pstree -p 进程号
# top -Hp 进程号
3.根据进程名字进行查询:
# pstree -p `ps -e | grep server | awk '{print $1}'`
# pstree -p `ps -e | grep server | awk '{print $1}'` | wc -l
4.查看线程数
需要得到线程的PID
查看进程的所有线程 # ps mp 6648 -o THREAD,tid USER %CPU PRI SCNT WCHAN USER SYSTEM TID root 0.0 - - - - - - root 0.0 24 - - - - 6648 root 0.0 21 - - - - 6650 root 1.0 24 - - - - 14214 root 0.0 23 - futex_ - - 14216 root 0.0 22 - 184466 - - 15374 root 0.0 23 - 184466 - - 15376 root 0.0 23 - 184466 - - 15378 root 0.0 23 - 184466 - - 15380 root 0.0 23 - 184466 - - 15392 root 0.0 23 - 184466 - - 15394 root 0.0 23 - 184466 - - 15398 查看所有子进程: # pstree -p 6648 agent_executor(6648)─┬─tar(15601)───gzip(15607) ├─{agent_executor}(6650) ├─{agent_executor}(14214) ├─{agent_executor}(14216) ├─{agent_executor}(15374) ├─{agent_executor}(15376) ├─{agent_executor}(15378) ├─{agent_executor}(15380) ├─{agent_executor}(15392) ├─{agent_executor}(15394) └─{agent_executor}(15398)
5. 进程启动时间(运行多长时间)
ps -eo lstart 启动时间
ps -eo etime 运行多长时间.
ps -eo pid,lstart,etime | grep 5176
========================================ps aux 或 lax 输出的解释========================= 2、ps aux 或 lax 输出的解释 au(x) 输出格式 : USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND USER: 进程所有者 PID: 进程ID %CPU: 占用的 CPU 使用率 %MEM: 占用的内存使用率 VSZ: 占用的虚拟内存大小 RSS: 占用的内存大小 TTY: 终端的次要装置号码 (minor device number of tty) STAT: 进程状态: START: 启动进程的时间; TIME: 进程消耗CPU的时间; COMMAND:命令的名称和参数;
相关文章推荐
- Linux Container(LXC容器)的基本命令使用简介
- Linux系统下查看网卡的UUID
- Linux网络属性管理
- Linux中vim的用法
- Linux管理员必须知道的sudo命令
- Linux环境下NodeJS的安装配置(HelloWorld)
- VMware8安装配置Win7、CentOS-7向导
- linux 历史简介
- window虚拟机安装Linux
- GIT在LINUX下的基本操作
- 实例解析Linux下iptables的相关配置与命令使用技巧
- Linux各发行版的异同比较
- linux ls -l 详解
- linux 下取进程占用 cpu/内存 最高的前10个进程
- linux 下取进程占用 cpu/内存 最高的前10个进程
- Linux UID EDUI
- Linux中的likely()和unlikely()
- centos5.8挂载ntfs移动硬盘
- Linux设备驱动之六----异步通知的驱动程序
- linux 环境 搭建 jenkins