[Bash] ps & pgrep commands
ps
The ps
command is used to display information about running processes.
This command displays a snapshot of the current processes.
Common Options:
- aux: Displays all processes in a detailed format.
- -e: Shows all processes.
- -f: Displays full-format listing.
# Display all running processes:
ps aux
Display all processes in full-format listing:
# ps -e
pgrep
The pgrep command searches for processes based on name and other attributes.
pgrep process_name
This command returns the process IDs of all processes with the given name.
# Find the process ID of a process named
$ pgrep postgres
473
592
593
594
595
596
597
# Find the process IDs and names of a process named bash:
$ pgrep -l postgres
473 postgres
592 postgres
593 postgres
594 postgres
595 postgres
596 postgres
597 postgres
# Find the process IDs of processes for a specific user:
$ pgrep -u username
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2023-05-24 [HTML 5] Detect visualViewport change
2023-05-24 [React Typescript] useRef with HTML Elements
2023-05-24 [Rust] Option vs Result
2023-05-24 [Rust] Handle Error
2023-05-24 [Rust] Option
2022-05-24 [Next.js] Override the Default Next.js Document
2022-05-24 [Next.js] Override the Default App Component in Next.js