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

top

Watch the processes live, sorted by CPU, with load, CPU and memory totals — and kill or renice from it.

المستوى
امتحان RHCSA
المجموعة
العمليات والمهام
يحتاج root
لا
الحزمة
procps-ng

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

ماذا يفعل

The top part shows uptime and load average, the number of tasks per state, CPU use (us user, sy system, ni niced, id idle, wa waiting for I/O, st stolen by the hypervisor) and memory and swap. Below is the process list, refreshed every 3 seconds.

Keys work while it runs: k kill, r renice, M sort by memory, P by CPU, 1 each CPU, q quit. With -b it writes plain text for logs and scripts.

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

top [OPTION]...

الأجزاء الرئيسية

k
Kill: send a signal to a PID.
r
Renice a PID.
P / M / T / N
Sort by CPU / memory / time / PID.
1
Show every CPU.
c
Show the full command line.
u
Show only one user.
f
Choose and sort columns.
H
Show threads.
V
Forest (tree) view.
E / e
Change memory units (summary / list).
W
Save the settings in ~/.config/procps/toprc.
h
Help.
q
Quit.

الخيارات 19

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

-b, --batch
Batch mode: plain text output (for logs and pipes).
-n, --iterations NUMBER
Stop after NUMBER updates.
-d, --delay SECONDS
Seconds between updates.
-p, --pid PIDLIST
Only these PIDs.
-u, --filter-only-euser USER
Only this effective user.
-U, --filter-any-user USER
Any user ID match (real, effective, saved, file).
-o, --sort-override FIELD
Sort by this field, like -o %MEM.
-H, --threads-show
Show threads.
-c, --cmdline-toggle
Start with full command lines.
-i, --idle-toggle
Hide idle processes.
-S, --accum-time-toggle
Cumulative time (with dead children).
-E, --scale-summary-mem k|m|g|t|p|e
Units in the summary.
-e, --scale-task-mem k|m|g|t|p
Units in the list.
-O, --list-fields
List the field names.
-s, --secure-mode
Secure mode (no kill or renice).
-w, --width [COLUMNS]
Output width in batch mode.
-1, --single-cpu-toggle
Start with each CPU shown (or one line).
-h, --help
Show help.
-V, --version
Show the version.

أمثلة 10

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

  1. 1Start top

    top
    top - 10:52:01 up  2:54,  2 users,  load average: 0.15, 0.10, 0.09
    Tasks: 182 total,   1 running, 181 sleeping,   0 stopped,   0 zombie
    %Cpu(s):  1.2 us,  0.5 sy,  0.0 ni, 98.1 id,  0.2 wa,  0.0 hi,  0.0 si,  0.0 st
    MiB Mem :   3654.2 total,   2201.7 free,    812.4 used,    891.3 buff/cache

    Press q to leave.

  2. 2Sort by memory

    top -o %MEM

    Or press M inside top.

  3. 3Only one user

    top -u apache

    Watch the web server processes.

  4. 4One process and its threads

    top -H -p $(pidof chronyd)

    Which thread uses the CPU.

  5. 5Save one snapshot to a file

    top -b -n 1 > /tmp/top-$(date +%H%M).txt

    Evidence for a slow-server ticket.

  6. 6Log every 10 seconds for one minute

    top -b -d 10 -n 6 | grep -A 8 '^top' > /tmp/top.log

    A short performance log.

  7. 7Kill from top

    top

    Press k, type the PID, press Enter (15) or type 9.

  8. 8Read the CPU line

    top -b -n 1 | grep Cpu

    High wa = slow disk; high st = the hypervisor is overloaded; high sy = kernel work.

  9. 9Find a crypto miner (security)

    top -b -n 1 -o %CPU | head -12

    An unknown process at 100% CPU, often from /tmp or a strange user.

  10. 10Secure mode for a shared screen

    top -s

    Nobody can kill from this top.

انتبه

  • Load average counts waiting processes, also those waiting for disk. High load with low CPU use often means slow storage or NFS.

الملفات

~/.config/procps/toprc
Saved settings (W key).

رموز الخروج

0 :: Done. 1 :: Error.

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

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

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