> For the complete documentation index, see [llms.txt](https://toska.gitbook.io/echoshell/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://toska.gitbook.io/echoshell/linux-system-adminstrato/analyze-tools/top.md).

# Top

### Usage

* f  - customize top show options
* 'N' - to sort the list by process id
* 'P' - to sort the process list by cpu usage.
* 'T' - to sort by the running time.
* 'Mm' - to sort by the memory
* 1 - show all cpus usage
* -d/d - delay seconds `top -d 2`
* -c/c - show it will display absolute path of running process.
* -u - `top -u mysql`
* save top results `top -n 1 -b > top-output.txt`
* -r/r  - renice pid

```
Fields Management for window 1:Def, whose current sort field is %CPU
   Navigate with Up/Dn, Right selects for move then <Enter> or Left commits,
   'd' or <Space> toggles display, 's' sets sort.  Use 'q' or <Esc> to end!

* PID     = Process Id      TTY     = Controlling T   vMj     = Major Faults
* USER    = Effective Use   TPGID   = Tty Process G   vMn     = Minor Faults
* PR      = Priority        SID     = Session Id      USED    = Res+Swap Size
* NI      = Nice Value      nTH     = Number of Thr   nsIPC   = IPC namespace
* VIRT    = Virtual Image   P       = Last Used Cpu   nsMNT   = MNT namespace
* RES     = Resident Size   TIME    = CPU Time        nsNET   = NET namespace
* SHR     = Shared Memory   SWAP    = Swapped Size    nsPID   = PID namespace
* S       = Process Statu   CODE    = Code Size (Ki   nsUSER  = USER namespac
* %CPU    = CPU Usage       DATA    = Data+Stack (K   nsUTS   = UTS namespace
* %MEM    = Memory Usage    nMaj    = Major Page Fa   LXC     = LXC container
* TIME+   = CPU Time, hun   nMin    = Minor Page Fa   RSan    = RES Anonymous
* COMMAND = Command Name/   nDRT    = Dirty Pages C   RSfd    = RES File-base
  PPID    = Parent Proces   WCHAN   = Sleeping in F   RSlk    = RES Locked (K
  UID     = Effective Use   Flags   = Task Flags <s   RSsh    = RES Shared (K
  RUID    = Real User Id    CGROUPS = Control Group   CGNAME  = Control Group
  RUSER   = Real User Nam   SUPGIDS = Supp Groups I
  SUID    = Saved User Id   SUPGRPS = Supp Groups N
  SUSER   = Saved User Na   TGID    = Thread Group
  GID     = Group Id        OOMa    = OOMEM Adjustm
  GROUP   = Group Name      OOMs    = OOMEM Score c
  PGRP    = Process Group   ENVIRON = Environment v
```

* P - to sort the process list by cpu usage.

```
top - 14:53:48 up 37 days, 11:48,  1 user,  load average: 0.04, 0.02, 0.00
Tasks: 113 total,   1 running,  64 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.3 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :   933940 total,   143140 free,   117112 used,   673688 buff/cache
KiB Swap:        0 total,        0 free,        0 used.   797212 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
31375 root      20   0    9248   3596   3000 R   0.7  0.4   0:00.15 top
31030 root      20   0       0      0      0 I   0.3  0.0   0:00.70 kworker/3:1
    1 root      20   0  161124   6324   3852 S   0.0  0.7   2:11.36 systemd
    2 root      20   0       0      0      0 S   0.0  0.0   0:04.35 kthreadd
    4 root       0 -20       0      0      0 I   0.0  0.0   0:00.00 kworker/0:+
    6 root       0 -20       0      0      0 I   0.0  0.0   0:00.00 mm_percpu_+
    7 root      20   0       0      0      0 S   0.0  0.0   0:03.62 ksoftirqd/0
    8 root      20   0       0      0      0 I   0.0  0.0   2:16.78 rcu_preempt
    9 root      20   0       0      0      0 I   0.0  0.0   0:06.39 rcu_sched
   10 root      20   0       0      0      0 I   0.0  0.0   0:00.00 rcu_bh
   11 root      rt   0       0      0      0 S   0.0  0.0   0:00.09 migration/0
   12 root      20   0       0      0      0 S   0.0  0.0   0:00.00 cpuhp/0
   13 root      20   0       0      0      0 S   0.0  0.0   0:00.00 cpuhp/1
   14 root      rt   0       0      0      0 S   0.0  0.0   0:00.10 migration/1
   15 root      20   0       0      0      0 S   0.0  0.0   1:02.31 ksoftirqd/1
   17 root       0 -20       0      0      0 I   0.0  0.0   0:00.00 kworker/1
```

T' - to sort by the running time.

```
top - 14:54:28 up 37 days, 11:49,  1 user,  load average: 0.02, 0.02, 0.00
Tasks: 113 total,   1 running,  64 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.1 us,  0.2 sy,  0.0 ni, 99.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :   933940 total,   143108 free,   117144 used,   673688 buff/cache
KiB Swap:        0 total,        0 free,        0 used.   797180 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 1206 root      20   0   80336   1592   1228 S   0.0  0.2   6:51.88 irqbalance
   51 root      20   0       0      0      0 S   0.0  0.0   3:31.97 kswapd0
    8 root      20   0       0      0      0 I   0.0  0.0   2:16.79 rcu_preempt
    1 root      20   0  161124   6324   3852 S   0.0  0.7   2:11.36 systemd
  179 root      20   0       0      0      0 S   0.0  0.0   1:59.73 mmcqd/0
 1211 root      20   0  234960   3052   2012 S   0.0  0.3   1:24.01 accounts-d+
21786 systemd+  20   0   28012   2180   1436 S   0.0  0.2   1:23.21 systemd-ne+
   15 root      20   0       0      0      0 S   0.0  0.0   1:02.31 ksoftirqd/1
 1207 root      20   0  298464   1684    920 S   0.0  0.2   0:55.13 lxcfs
21802 root      19  -1   47484  18032  12616 S   0.0  1.9   0:45.68 systemd-jo+
 1226 root      20   0    7172   1264    964 S   0.0  0.1   0:17.61 cron
  590 root      20   0       0      0      0 S   0.0  0.0   0:14.62 jbd2/mmcbl+
 1223 root      20   0   10452   2804   2000 S   0.0  0.3   0:13.83 systemd-lo+
   25 root      20   0       0      0      0 S   0.0  0.0   0:13.55 ksoftirqd/3
 1212 message+  20   0    7116   2540   1600 S   0.0  0.3   0:12.46 dbus-daemon
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://toska.gitbook.io/echoshell/linux-system-adminstrato/analyze-tools/top.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
