We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ps命令详解
ps -ef | grep {processName}
ps -ef | grep {pid}
netstat -tunlp | grep {port}
示例:
# netstat -tunlp | grep 8080 tcp6 0 0 :::8080 :::* LISTEN 29150/java
则 29150 为当前端口所对应的进程 pid
lsof -i tcp:{port}
netstat -nap | grep {pid}
lsof -p {pid}|grep LISTEN
ps -A -ostat,ppid,pid,cmd | grep -e '^[Zz]'
-A
-o
# 查看最消耗CPU的进程 ps -eo pid,ppid,%mem,%cpu,cmd --sort=-%cpu | head # 查看最消耗内存的进程 ps -eo pid,ppid,%mem,%cpu,cmd --sort=-%mem | head
The text was updated successfully, but these errors were encountered:
superleeyom
No branches or pull requests
ps 命令详解
ps命令详解
根据进程名查询进程信息
ps -ef | grep {processName}
根据进程pid查询进程信息
ps -ef | grep {pid}
根据端口查看对应进程信息
Linux
netstat -tunlp | grep {port}
示例:
则 29150 为当前端口所对应的进程 pid
MacOS
查看进程pid占用端口情况
Linux
netstat -nap | grep {pid}
MacOS
lsof -p {pid}|grep LISTEN
查询僵尸进程
-A
参数列出所有进程-o
自定义输出字段 我们设定显示字段为 stat(状态), ppid(进程父id), pid(进程id),cmd(命令)这四个参数查看最消耗CPU和内存的进程
The text was updated successfully, but these errors were encountered: