ps auxดูเหมือนว่าเพื่อความสะดวกในรายการกระบวนการทั้งหมดและสถานะของพวกเขาและการใช้ทรัพยากร (Linux / BSD / MacOS) แต่ฉันไม่สามารถเข้าใจความหมายของพารามิเตอร์ที่ใช้auxman ps
อะไรauxหมายความว่าอย่างไร
ps auxดูเหมือนว่าเพื่อความสะดวกในรายการกระบวนการทั้งหมดและสถานะของพวกเขาและการใช้ทรัพยากร (Linux / BSD / MacOS) แต่ฉันไม่สามารถเข้าใจความหมายของพารามิเตอร์ที่ใช้auxman ps
อะไรauxหมายความว่าอย่างไร
คำตอบ:
a = แสดงกระบวนการสำหรับผู้ใช้ทั้งหมด
u = แสดงผู้ใช้ / เจ้าของ
x = แสดงกระบวนการที่ไม่ได้เชื่อมต่อกับเทอร์มินัล
โดยวิธีการที่man psเป็นทรัพยากรที่ดี
ประวัติศาสตร์ BSD และ AT & T psพัฒนารุ่นที่เข้ากันไม่ได้ของ ตัวเลือกที่ไม่มีเส้นประนำ (ตามคำถาม) คือรูปแบบ BSD ในขณะที่ตัวเลือกนำหน้าเป็นรูปแบบ AT&T Unix นอกเหนือจากนี้ Linux ได้พัฒนาเวอร์ชันที่รองรับทั้งสองสไตล์จากนั้นเพิ่มสไตล์ที่สามด้วยตัวเลือกที่เริ่มต้นด้วยเครื่องหมายขีดคั่นคู่
ทั้งหมด (หรือเกือบทั้งหมด) ลินุกซ์ที่ไม่ฝังตัวใช้แตกต่างจากที่procpsชุด ตัวเลือกข้างต้นเป็นไปตามที่กำหนดไว้ในprocpspsหน้าคน
ในความคิดเห็นที่คุณพูดว่าคุณกำลังใช้ Apple MacOS (OSX ฉันเข้าใจ) OSX man page สำหรับpsอยู่ที่นี่และแสดงการสนับสนุนเฉพาะสไตล์ AT&T เท่านั้น
psและเวอร์ชัน Apple OSX คำถามนี้ถูกติดแท็ก "Linux" หากคุณกำลังถามเกี่ยวกับ MacOS คุณอาจต้องการอัปเดตแท็ก
auxหน้าคู่มือของ MacOS ไม่มีข้อมูลดังกล่าวอาจเป็นข้อผิดพลาดของเอกสาร
psพูดว่า "... ps auxยังคงทำงานเหมือนใน Tiger" ในส่วน "Legacy Description"
man psเป็นทรัพยากรที่ดีใน mac OSX หน้าคนเฉพาะตอนท้ายสุดเท่านั้นโน้ตที่ได้ps auxรับการดูแลรักษาเพื่อความสะดวก ท้ายที่สุดหน้า man นั้นยาวและซับซ้อนอย่างมากและผู้อ่านสามารถใช้เวลาตั้งคำถามกับสติของเขา / เธอก่อนที่จะยอมแพ้และ googling สำหรับคำถาม stackexchange นี้
a Lift the BSD-style "only yourself" 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
with a terminal (tty), or to list all processes when used together
with the x option.
u Display user-oriented format.
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.
$ ps aux | head -10
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 51120 2796 ? Ss Dec22 0:09 /usr/lib/systemd/systemd --system --deserialize 22
root 2 0.0 0.0 0 0 ? S Dec22 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S Dec22 0:04 [ksoftirqd/0]
root 5 0.0 0.0 0 0 ? S< Dec22 0:00 [kworker/0:0H]
root 7 0.0 0.0 0 0 ? S Dec22 0:15 [migration/0]
root 8 0.0 0.0 0 0 ? S Dec22 0:00 [rcu_bh]
root 9 0.0 0.0 0 0 ? S Dec22 2:47 [rcu_sched]
...
saml 3015 0.0 0.0 117756 596 pts/2 Ss Dec22 0:00 bash
saml 3093 0.9 4.1 1539436 330796 ? Sl Dec22 70:16 /usr/lib64/thunderbird/thunderbird
saml 3873 0.0 0.1 1482432 8628 ? Sl Dec22 0:02 gvim -f
root 5675 0.0 0.0 124096 412 ? Ss Dec22 0:02 /usr/sbin/crond -n
root 5777 0.0 0.0 51132 1068 ? Ss Dec22 0:08 /usr/sbin/wpa_supplicant -u -f /var/log/wpa_supplica
saml 5987 0.7 1.5 1237740 119876 ? Sl Dec26 14:05 /opt/google/chrome/chrome --type=renderer --lang=en-
root 6115 0.0 0.0 0 0 ? S Dec27 0:06 [kworker/0:2]
...
ด้วยสวิตช์ด้านบนคุณจะได้รับผลลัพธ์เกี่ยวกับกระบวนการของคุณเช่นด้านบน
สวิทช์auxจะแสดง:
กุญแจสำคัญในการทำความเข้าใจกับmanpageไม่ใช่เพื่อค้นหา "aux" (ซึ่งฉันได้ลองก่อน) แต่เพื่อมุ่งเน้นไปที่ส่วนที่อธิบายถึงชนิดของพารามิเตอร์ที่psใช้:
ps เวอร์ชันนี้ยอมรับตัวเลือกหลายชนิด:
- ตัวเลือก UNIX ซึ่งอาจถูกจัดกลุ่มและจะต้องนำหน้าด้วยเส้นประ
- ตัวเลือก BSD ซึ่งอาจถูกจัดกลุ่มและต้องไม่ใช้ร่วมกับเส้นประ
- ตัวเลือกแบบยาวของ GNU ซึ่งนำหน้าด้วยขีดกลางสองอัน
จากนี้เรารู้ว่าauxเป็นชุดของตัวเลือก (จัดกลุ่ม) BSD เป็นa, uและxซึ่งทำให้พวกเขาเล็กน้อยง่ายต่อการค้นหา
aและxควบคุมกระบวนการที่เลือกและใช้ร่วมกันอย่างชัดเจนเพื่ออธิบายกระบวนการทั้งหมด
u เอาต์พุตโดยใช้รูปแบบ "user-oriented" ซึ่งให้คอลัมน์เพิ่มเติมรวมถึง id ผู้ใช้และการใช้งาน CPU / หน่วยความจำ
aและxทำเช่นps u $pidนั้น
-uเป็นนอกคอกเพียงu?