الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

pstree

Show the running processes as a tree: who started whom.

المستوى
لينكس اليومي
المجموعة
العمليات والمهام
يحتاج root
لا
الحزمة
psmisc

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

ماذا يفعل

pstree draws the processes from systemd (PID 1) down. Identical children are compacted: httpd───5*[httpd] means five httpd children. Use -p for PIDs and -a for the full command lines.

طريقة الكتابة

pstree [OPTION]... [PID | USER]

الخيارات 20

الأكثر استخدامًا

-p
Show PIDs (turns off compaction).
-a
Show the command line arguments.
-u
Show user changes, like (apache).
-s
Show the parents of the given PID.
-h
Highlight the current process and its parents.
-H PID
Highlight this process.
-n
Sort by PID.
-c
Do not compact identical subtrees.
-l
Long lines (no cut).
-g
Show process group IDs.
-t
Full names of threads.
-T
Hide threads.
-A
ASCII lines.
-G
VT100 lines.
-U
UTF-8 lines.
-C age
Color by age.
-N TYPE
One tree per namespace (ipc, mnt, net, pid, user, uts, cgroup, time).
-S
Show namespace changes.
-Z
Show the SELinux context.
-V
Show the version.

أمثلة 10

$ مستخدم عادي# بصلاحية root (أو مع sudo)

  1. 1The whole tree

    pstree | head
    systemd─┬─NetworkManager───3*[{NetworkManager}]
            ├─chronyd
            ├─sshd───sshd───sshd───bash───pstree

    {…} are threads.

  2. 2With PIDs

    pstree -p | head

    Find the PID of a parent quickly.

  3. 3Tree of one process

    pstree -p 1010

    Only the sshd master and its sessions.

  4. 4Where does my shell come from?

    pstree -s -p $$
    systemd(1)───sshd(1010)───sshd(2210)───sshd(2215)───bash(2216)

    The chain of parents.

  5. 5Show the user of each part

    pstree -u

    (apache) shows where a process changed to another user.

  6. 6Full command lines

    pstree -a | less

    Shows the options of each program.

  7. 7Processes of one user

    pstree lisa

    All trees owned by lisa.

  8. 8Find odd children of a web server (security)

    pstree -p -a $(pgrep -o httpd)

    A shell (bash, sh) under httpd can mean a web shell attack.

  9. 9Do not compact

    pstree -c -p | grep httpd

    Every child on its own line.

  10. 10Container namespaces

    pstree -N pid

    Separate trees for each PID namespace (containers).

رموز الخروج

0Done.
1Error.

الدليل الكامل

هذه الصفحة تشرح الأمر بكلمات بسيطة. الدليل الأصلي فيه كل التفاصيل.

في الطرفية: man pstree