Dea*_*ith 82 linux unix command-line-interface mac-osx process
有没有办法按进程开始时间对 ps 输出进行排序,所以最新的是在顶部或底部?
在 Linux 上?
在 SysV5 上?
在 Mac 上?
Sek*_*nre 115
这应该适用于 Linux 和 SysV5
ps -ef --sort=start_time
Run Code Online (Sandbox Code Playgroud)
rkt*_*hkr 12
Linux:
$ ps aux --sort=lstart
Run Code Online (Sandbox Code Playgroud)
操作系统:
$ ps aux -O started
Run Code Online (Sandbox Code Playgroud)
小智 5
除了上面的好答案之外,有时我只想查看按时间、cpu% 和内存使用率降序排列的进程排名前 20 位的违规者。
为此,我使用:
ps auxww --sort=lstart | sort -r -k3,4 | head -20
Run Code Online (Sandbox Code Playgroud)
这将在 CentOS 平台上进行,尽管我在 Fedora 上也获得了相同的结果。
哦,对于咧嘴笑,我有时想删除一组进程,所以我只是使用上面的一个变体,其中包括一些 grep -v 操作,例如:
ps auxww --sort=lstart | sort -r -k3,4 | grep -v "sbin/httpd" | head -20
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
95973 次 |
| 最近记录: |