Top linux commands
The top command displays information about the processes being executed by the current system. Including process ID and memory usage. The top command format is as follows:
Top [OPTIONS] OPTIONS: -Batch B-c display the complete name of the process-I ignore invalid process-s confidentiality mode-S accumulation mode-I <time> set interval-u <User Name> specify user name- p <process number> specified process-n <times> Number of cycles displayed
Top output information:
top - 15:08:48 up 1:53, 3 users, load average: 0.00, 0.01, 0.05Tasks: 160 total, 1 running, 159 sleeping, 0 stopped, 0 zombieCpu(s): 0.1%us, 0.2%sy, 0.0%ni, 99.6%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%stMem: 2061364k total, 1029032k used, 1032332k free, 224832k buffersSwap: 2095100k total, 0k used, 2095100k free, 440620k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1777 root 20 0 150m 80m 13m S 4 4.0 0:19.91 Xorg 3602 gino 20 0 91844 15m 10m S 2 0.8 0:00.45 gnome-terminal 1 root 20 0 3644 1968 1280 S 0 0.1 0:00.80 init 2 root 20 0 0 0 0 S 0 0.0 0:00.00 kthreadd 3 root 20 0 0 0 0 S 0 0.0 0:00.06 ksoftirqd/0 4 root 20 0 0 0 0 S 0 0.0 0:00.00 kworker/0:0 6 root RT 0 0 0 0 S 0 0.0 0:00.00 migration/0 7 root RT 0 0 0 0 S 0 0.0 0:00.03 watchdog/0 8 root RT 0 0 0 0 S 0 0.0 0:00.00 migration/1 10 root 20 0 0 0 0 S 0 0.0 0:00.07 ksoftirqd/1 11 root 20 0 0 0 0 S 0 0.0 0:00.50 kworker/0:1 12 root RT 0 0 0 0 S 0 0.0 0:00.03 watchdog/1 13 root RT 0 0 0 0 S 0 0.0 0:00.00 migration/2 15 root 20 0 0 0 0 S 0 0.0 0:00.02 ksoftirqd/2 16 root RT 0 0 0 0 S 0 0.0 0:00.03 watchdog/2 17 root RT 0 0 0 0 S 0 0.0 0:00.00 migration/3 19 root 20 0 0 0 0 S 0 0.0 0:00.02 ksoftirqd/3 20 root RT 0 0 0 0 S 0 0.0 0:00.03 watchdog/3 21 root 0 -20 0 0 0 S 0 0.0 0:00.00 cpuset 22 root 0 -20 0 0 0 S 0 0.0 0:00.00 khelper 23 root 20 0 0 0 0 S 0 0.0 0:00.00 kdevtmpfs 24 root 0 -20 0 0 0 S 0 0.0 0:00.00 netns 25 root 20 0 0 0 0 S 0 0.0 0:00.00 kworker/u:1 26 root 20 0 0 0 0 S 0 0.0 0:00.02 sync_supers 27 root 20 0 0 0 0 S 0 0.0 0:00.00 bdi-default 28 root 0 -20 0 0 0 S 0 0.0 0:00.00 kintegrityd 29 root 0 -20 0 0 0 S 0 0.0 0:00.00 kblockd 30 root 0 -20 0 0 0 S 0 0.0 0:00.00 ata_sff 31 root 20 0 0 0 0 S 0 0.0 0:00.00 khubd 32 root 0 -20 0 0 0 S 0 0.0 0:00.00 md 34 root 20 0 0 0 0 S 0 0.0 0:00.00 khungtaskd 35 root 20 0 0 0 0 S 0 0.0 0:00.00 kswapd0 36 root 25 5 0 0 0 S 0 0.0 0:00.00 ksmd 37 root 39 19 0 0 0 S 0 0.0 0:00.00 khugepaged 38 root 20 0 0 0 0 S 0 0.0 0:00.00 fsnotify_mark 39 root 20 0 0 0 0 S 0 0.0 0:00.00 ecryptfs-kthrea 40 root 0 -20 0 0 0 S 0 0.0 0:00.00 crypto 48 root 0 -20 0 0 0 S 0 0.0 0:00.00 kthrotld 49 root 20 0 0 0 0 S 0 0.0 0:00.00 scsi_eh_0 50 root 20 0 0 0 0 S 0 0.0 0:00.00 scsi_eh_1 52 root 20 0 0 0 0 S 0 0.0 0:00.00 kworker/u:3 71 root 0 -20 0 0 0 S 0 0.0 0:00.00 devfreq_wq 72 root 20 0 0 0 0 S 0 0.0 0:00.24 kworker/1:1
Top Command output information:
The first line is the same as the uptime command execution result 15:08:38 -- the current system time is up -- the system has run time (during which the system has not restarted) 3 users -- current number of users logging on to the system load average -- the system load value is 1 minute, 5 minutes, 15 minutes, and the second line. Process description: 160 total -- total number of processes in the system 1 running -- number of running processes 159 sleeping -- number of dormant processes 0 stopped -- number of terminated processes 0 zombie -- number of zombie processes in the third row, cpu status information 0.1% us -- percentage of CPU occupied by user space 0.2% sy -- percentage of CPU occupied by kernel space 0.0% ni -- percentage of CPU occupied by processes with changed priorities 99.6% id -- percentage of idle CPU 0.1% wa -- percentage of CPU occupied by I/O wait: 0.0% hi -- percentage of CPU occupied by hard interrupt: 0.0% si -- percentage of CPU occupied by Soft Interrupt 0.0% st -- the time when the CPU uses an internal virtual machine to run the task. Row 4: memory status 2061364 k total -- total physical memory 1029032 k used -- total used memory 1032332 k free -- total idle memory 224832 k buffers -- total cached memory the fifth line, swap partition information 2095100 k total -- Swap partition total 0 k used -- used interaction zone total 2095100 k free -- idle interaction zone total 440620 k cached -- cached interaction zone total
The seventh row is the State Monitoring Project column of each process. PID -- Process idUSER -- process owner PR -- Process Priority NI -- nice value. A negative value indicates a high priority, and a positive value indicates a low priority VIRT-the total amount of virtual memory used by the process. VIRT = SWAP + RESRES -- physical memory used by the process, not swapped out. RES = CODE + DATASHR -- size of the shared memory. S -- Process status. S: Sleep R: Run T: TRACE/Stop Z: Zombie process D: uninterruptible sleep status % CPU -- percentage of cpu time consumed since the last update % MEM -- Process usage regardless of memory percentage TIME + -- total cpu time used by the process, unit: 1/100 seconds COMMAND -- process name
Top interactive commands
After running the top command, you can use some interactive commands. These commands are single-letter. If the s option is used in the command line, some of these commands may be blocked.
H. The help screen is displayed, and some brief command summaries are provided to explain that k terminates a process. I ignore idle and dead processes. This is a switch-on command. Q exit program r reschedule the priority S of a process to switch to the cumulative Mode s to change the delay time between two refreshes (unit: s). If there is a decimal number, it is converted to m s. If the input value is 0, the system will continue to refresh, the default value is 5 sf or F. add or delete a project from the current display. o or O changes. display the order of items. l switch. display average load and start time. m switch. Display memory information. t switch. display process. and CPU status information c switch display command name and complete command line M sort by resident memory size P sort by CPU usage percentage T sort by time/accumulative time W set the current write ~ /. Toprc File