• Home
  • LLMs
  • Docker
  • Kubernetes
  • Java
  • All
  • About
Linux-Ubuntu | top -- display processes
  1. Notes
  2. Examples

  1. Notes
    Usage:
    top -hv | -bcHiOSs -d secs -n max -u|U user -p pid(s) -o field -w [cols]

    The command top display the system summary information that is organized on 5 areas.
    The first area display the current time, the time since last boot, the total number of users, the system load average over the last 1, 5 and 15 minutes.
    The second area display the number of processes and how much of them are running, sleeping, stopped, zombie.
    The last areas display information about the CPU, the physical memory, and the swap memory.

    The command top also display a detailed list of all running processes.
    By default the list provides the following headers:
    • PID: the process id.
    • USER: the owner of the process.
    • PR: the priority of the process.
    • NI: the nice value of the process.
    • VIRT: the virtual memory used by the process.
    • RES: the physical memory used by the process.
    • SHR: the shared memory with other processes.
    • S: the process status (D: uninterruptible sleep, R: running, S: sleeping, T: stopped by job control signal, t: stopped by debugger during trace, Z: zombie).
    • %CPU: the share of CPU time that the process is suing.
    • %MEM: the share of physical memory that the process is suing.
    • TIME+: the CPU time used by the process.
    • COMMAND: the command line used to start the process.
  2. Examples
    $ top
    top - 17:23:08 up 1 day,  6:10,  1 user,  load average: 0.11, 0.04, 0.01
    Tasks: 226 total,   1 running, 159 sleeping,   0 stopped,   0 zombie
    %Cpu(s):  0.2 us,  0.1 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
    KiB Mem : 32654668 total, 29423936 free,   798248 used,  2432484 buff/cache
    KiB Swap: 37109756 total, 37109756 free,        0 used. 31335344 avail Mem
    
      PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
     1602 root      20   0 1570844  46868  26052 S   0.7  0.1   1:09.06 containerd
     1595 mongodb   20   0 1583628 106204  38000 S   0.3  0.3   9:02.59 mongod
     1792 mysql     20   0 1426572 181280  15792 S   0.3  0.6   1:21.88 mysqld
     ...

    By default the list is sorted using the %CPU column.
    To change the headers (add or remove) and/or adjust the sort column, press the key 'f'.
    Navigate with Up/Dn.
    Press the key 'd' or <space> to add or remove a header.
    Press the key 's' to apply changes.
    Press the key 'q' or <esc> to exit.

    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             ENVIRON = Environment vars
    * USER    = Effective User Name    vMj     = Major Faults delta
    * PR      = Priority               vMn     = Minor Faults delta
    * NI      = Nice Value             USED    = Res+Swap Size (KiB)
    * VIRT    = Virtual Image (KiB)    nsIPC   = IPC namespace Inode
    * RES     = Resident Size (KiB)    nsMNT   = MNT namespace Inode
    * SHR     = Shared Memory (KiB)    nsNET   = NET namespace Inode
    * S       = Process Status         nsPID   = PID namespace Inode
    * %CPU    = CPU Usage              nsUSER  = USER namespace Inode
    * %MEM    = Memory Usage (RES)     nsUTS   = UTS namespace Inode
    * TIME+   = CPU Time, hundredths   LXC     = LXC container name
    * COMMAND = Command Name/Line      RSan    = RES Anonymous (KiB)
      PPID    = Parent Process pid     RSfd    = RES File-based (KiB)
      UID     = Effective User Id      RSlk    = RES Locked (KiB)
      RUID    = Real User Id           RSsh    = RES Shared (KiB)
      RUSER   = Real User Name         CGNAME  = Control Group name
      SUID    = Saved User Id
      SUSER   = Saved User Name
      GID     = Group Id
      GROUP   = Group Name
      PGRP    = Process Group Id
      TTY     = Controlling Tty
      TPGID   = Tty Process Grp Id
      SID     = Session Id
      nTH     = Number of Threads
      P       = Last Used Cpu (SMP)
      TIME    = CPU Time
      SWAP    = Swapped Size (KiB)
      CODE    = Code Size (KiB)
      DATA    = Data+Stack (KiB)
      nMaj    = Major Page Faults
      nMin    = Minor Page Faults
      nDRT    = Dirty Pages Count
      WCHAN   = Sleeping in Function
      Flags   = Task Flags <sched.h>
      CGROUPS = Control Groups
      SUPGIDS = Supp Groups IDs
      SUPGRPS = Supp Groups Names
      TGID    = Thread Group Id
      OOMa    = OOMEM Adjustment
      OOMs    = OOMEM Score current
© 2025  mtitek