日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ps 究竟是 aux 还是 ef

發布時間:2023/12/20 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ps 究竟是 aux 还是 ef 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

文章目錄

  • 1 Overview
  • 2 aux or ef
  • 3 stand syntax
  • 4 BSD syntax
  • 5 Summary

1 Overview

相信肯定會有同學有遇到過一個面試題,問:如何查看系統當前所有的進程?

這個答案相信大部分人都知道,當然就是 ps 了。但是,如果你回到 ps aux,如果考官問你是否知道 ps -ef 呢?又或者反過來呢?

本文就這個問題簡單解答一下。

2 aux or ef

這種問題要解決,也是非常容易的,當然就是查手冊了!man ps。

...省略... To see every process on the system using standard syntax:ps -eps -efps -eFps -elyTo see every process on the system using BSD syntax:ps axps axu ...省略...

很明顯,不管是 ps aux 還是 ps -ef,都能打印系統所有的進程,那么局別在哪里呢?其實就是在于打印的格式。

3 stand syntax

舉個例子。

# ps -ef | head -n 10 UID PID PPID C STIME TTY TIME CMD root 1 0 0 2018 ? 00:02:04 /sbin/init root 2 0 0 2018 ? 00:00:05 [kthreadd] root 3 2 0 2018 ? 00:03:03 [ksoftirqd/0] root 5 2 0 2018 ? 00:00:00 [kworker/0:0H] root 8 2 0 2018 ? 00:02:15 [migration/0] root 9 2 0 2018 ? 00:00:00 [rcu_bh]

4 BSD syntax

舉個例子。

ps aux | head -n 10 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 22388 1620 ? Ss 2018 2:04 /sbin/init root 2 0.0 0.0 0 0 ? S 2018 0:05 [kthreadd] root 3 0.0 0.0 0 0 ? S 2018 3:03 [ksoftirqd/0] root 5 0.0 0.0 0 0 ? S< 2018 0:00 [kworker/0:0H] root 8 0.0 0.0 0 0 ? S 2018 2:15 [migration/0] root 9 0.0 0.0 0 0 ? S 2018 0:00 [rcu_bh] root 10 0.0 0.0 0 0 ? S 2018 0:00 [rcuob/0] root 11 0.0 0.0 0 0 ? S 2018 0:00 [rcuob/1] root 12 0.0 0.0 0 0 ? S 2018 0:00 [rcuob/2]A

5 Summary

https://askubuntu.com/questions/129962/ps-ef-vs-ps-aux

從以上那個回答來看 ps -e 和 ps ax 是幾乎相同的,但是我們從手冊可以看到,-f 和 x 選項會有一些局別,如下。

...省略...x Lift the BSD-style "must have a tty" restriction, which is imposed upon the set of all processes when some BSD-style (without "-") options are used or when the ps personality setting is BSD-like. The set of processes selected in this manner is in addition to the set of processes selected by other means. An alternate description is that this option causes ps to list all processes owned by you (same EUID as ps), or to list all processes when used together with the a option. ...省略...-f does full-format listing. This option can be combined with many other UNIX-style options to add additional columns. It also causes the command arguments to be printed. When used with -L, the NLWP (number of threads) and LWP (thread ID) columns will be added. See the c option, the format keyword args, and the format keyword comm.

根據手冊來看,x 就是打印 BSD 風格,-f 同樣也是打印格式的問題。

總體來說,如果只是需要 grep 或者拉進程號之列的操作,以上區別是沒有實際意義的,用戶可以忽略。

總結

以上是生活随笔為你收集整理的ps 究竟是 aux 还是 ef的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。