Forrest logo
tool overview
On this page you find all important commands for the CLI tool top. If the command you are looking for is missing please ask our AI.

top

The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of processes or threads currently being managed by the Linux kernel. The types of system summary information shown and the types, order and size of information displayed for processes are all user configurable and that configuration can be made persistent across restarts.

List of commands for top:

  • system:cpu:usage Displays CPU usage as a percentage in Linux
    $ top -b -n 1 | grep '%Cpu' | awk '{print $2}'
    try on your machine
    explain this command
  • top:tldr:00c58 top: Show only processes owned by given user.
    $ top -u ${username}
    try on your machine
    explain this command
  • top:tldr:36ec1 top: Show the individual threads of a given process.
    $ top -Hp ${process_id}
    try on your machine
    explain this command
  • top:tldr:582dd top: Sort processes by a field.
    $ top -o ${field_name}
    try on your machine
    explain this command
  • top:tldr:5cd11 top: process ID).
    $ top -o mem
    try on your machine
    explain this command
  • top:tldr:706fe top: Start top sorting processes first by CPU, then by running time.
    $ top -o cpu -O time
    try on your machine
    explain this command
  • top:tldr:90df5 top: Start top displaying only processes owned by given user.
    $ top -user ${user_name}
    try on your machine
    explain this command
  • top:tldr:9652b top: Show only the processes with the given PID(s), passed as a comma-separated list. (Normally you wouldn't know PIDs off hand. This example picks the PIDs from the process name).
    $ top -p $(pgrep -d ',' ${process_name})
    try on your machine
    explain this command
  • top:tldr:b2835 top: Start top.
    $ top
    try on your machine
    explain this command
  • top:tldr:b80eb top: Do not show any idle or zombie processes.
    $ top -i
    try on your machine
    explain this command
tool overview