Rate This Document
Findability
Accuracy
Completeness
Readability

Top Commands

Internal Top Commands

When the top session is running, you can run internal top commands to control the display mode of processes.

Table 1 describes the internal commands.

Table 1 Internal top commands

No.

Command

Function

1

s

Change the image update frequency.

2

l

Show or hide the first line for the top information in the first part of the top command output.

3

t

Show or hide the second line for tasks and the third line for CPUs in the first part of the top command output.

4

m

Show or hide the fourth line for Mem and the fifth line for Swap in the first part of the top command output.

5

N

Sort processes by PID in ascending or descending order.

6

P

Sort processes by CPU usage in ascending or descending order.

7

M

Sort processes by memory usage in ascending or descending order.

8

h

Display help information.

9

q

Exit the top session.

10

n

Set the number of processes displayed in the process list.

11

s

Change the image update period.

Other Columns of the Top Command

By default, only the important PID, USER, PR, NI, VIRT, RES, SHR, S, %CPU, %MEM, TIME+, and COMMAND columns are displayed. You can use the following shortcut keys to change the displayed content.

  • After you press f, the column list is displayed. Press a to z to display or hide the corresponding column. Then press Enter.
  • Press o to change the display sequence of the selected columns. Press a to z to move the corresponding column to the right, and press A to Z to move the corresponding column to the left. Then press Enter.
  • Press F or O, and then press a to z to sort the processes by the corresponding columns. Press R to reverse the sorting.
Table 2 describes the common top commands and their functions.
Table 2 Common commands and their functions

No.

Command

Function

1

PID

Process ID.

2

PPID

Parent process ID.

3

RUSER

Real user name

4

UID

User ID of the process owner.

5

USER

User name of the process owner.

6

GROUP

Group name of the process owner.

7

TTY

Name of the terminal where the process is started. If the process is not started from a terminal, a question mark (?) is displayed.

8

PR

Priority.

9

NI

Nice value: A negative value indicates a high priority and a positive value indicates a low priority.

10

P

Last used CPU. This command is valid only in a multi-CPU environment.

11

%CPU

CPU usage since the latest update.

12

TIME

Total time of CPUs being used by the process, in seconds.

13

TIME+

Total time of CPUs being used by the process, in centiseconds.

14

%MEM

Percentage of the physical memory occupied by the process.

15

VIRT

Total virtual memory used by the process, in KB.

VIRT=SWAP+RES

16

SWAP

Swapped-out size of the virtual memory used by the process, in KB.

17

RES

Non-swapped-out size of the physical memory used by the process, in KB.

RES=CODE+DATA

18

CODE

Physical memory occupied by executable code, in KB.

19

DATA

Physical memory occupied by non-executable code (data segments + stacks), in KB.

20

SHR

Shared memory, in KB.

21

nFLT

Number of page errors.

22

nDRT

Number of pages that have been modified since the last write.

23

S

Process status.

  • D: The process is in unstoppable sleep state.
  • R: running.
  • S: sleep.
  • T: trace/stop.
  • Z: zombie process.

24

COMMAND

Command name or command line.

25

WCHAN

If the process is sleeping, the name of the sleeping system function is displayed.

26

Flags

Task flag.