How to Exit or Quit Top Command in Linux or Unix Terminal
This post will guide you how to exit from top command without closing my Linux terminal. For a Linux user, if you want to check the usage or information about all process in your current Linux operating system, you can use top command to get it.
The top command will display 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.
To display Linux processes, type the following command in your Linux terminal:
$ top
Outputs:
top - 20:19:37 up 1:37, 1 user, load average: 0.00, 0.01, 0.05 Tasks: 160 total, 1 running, 159 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.3 us, 0.7 sy, 0.0 ni, 99.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1014972 total, 69732 free, 558076 used, 387164 buff/cache KiB Swap: 2097148 total, 2097148 free, 0 used. 243328 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 5204 root 20 0 162012 2284 1588 R 0.7 0.2 0:00.04 top 5068 root 20 0 0 0 0 S 0.3 0.0 0:00.52 kworker/0:2 1 root 20 0 128284 6856 4176 S 0.0 0.7 0:01.62 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:00.16 ksoftirqd/0 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H 6 root 20 0 0 0 0 S 0.0 0.0 0:00.12 kworker/u2:0 7 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh 9 root 20 0 0 0 0 S 0.0 0.0 0:00.76 rcu_sched 10 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 lru-add-dra+ 11 root rt 0 0 0 0 S 0.0 0.0 0:00.08 watchdog/0 13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs 14 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns
When you are in interactive mode of top command, you can send signals to processes. And if you want to quit the current top command, you just press q key on your keyboard to exit from top command session.
And if you get more help in the interactive mode of top, you can press ? or h key to accomplish the result.
For example, when you press h key, it would display the below similar outputs:
Help for Interactive Commands - procps-ng version 3.3.10 Window 1:Def: Cumulative mode Off. System: Delay 3.0 secs; Secure mode Off. Z,B,E,e Global: 'Z' colors; 'B' bold; 'E'/'e' summary/task memory scale l,t,m Toggle Summary: 'l' load avg; 't' task/cpu stats; 'm' memory info 0,1,2,3,I Toggle: '0' zeros; '1/2/3' cpus or numa node views; 'I' Irix mode f,F,X Fields: 'f'/'F' add/remove/order/sort; 'X' increase fixed-width L,&,<,> . Locate: 'L'/'&' find/again; Move sort column: '<'/'>' left/right R,H,V,J . Toggle: 'R' Sort; 'H' Threads; 'V' Forest view; 'J' Num justify c,i,S,j . Toggle: 'c' Cmd name/line; 'i' Idle; 'S' Time; 'j' Str justify x,y . Toggle highlights: 'x' sort field; 'y' running tasks z,b . Toggle: 'z' color/mono; 'b' bold/reverse (only if 'x' or 'y') u,U,o,O . Filter by: 'u'/'U' effective/any user; 'o'/'O' other criteria n,#,^O . Set: 'n'/'#' max tasks displayed; Show: Ctrl+'O' other filter(s) C,... . Toggle scroll coordinates msg for: up,down,left,right,home,end k,r Manipulate tasks: 'k' kill; 'r' renice d or s Set update interval W,Y Write configuration file 'W'; Inspect other output 'Y' q Quit ( commands shown with '.' require a visible task display window ) Press 'h' or '?' for help with Windows, Type 'q' or to continue
That’s it!