{"id":8548,"date":"2023-03-14T13:18:20","date_gmt":"2023-03-14T13:18:20","guid":{"rendered":"https:\/\/www.geekdecoder.com\/?p=8548"},"modified":"2023-03-14T13:18:20","modified_gmt":"2023-03-14T13:18:20","slug":"how-do-i-use-the-top-program","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2023\/03\/14\/how-do-i-use-the-top-program\/","title":{"rendered":"How do I use the top program"},"content":{"rendered":"\n<p>The top program is a command-line tool that shows system resource utilization, processes running, and their related information. It can be used in a terminal or command prompt.<\/p>\n\n\n\n<p>Let&#8217;s dig in to see more option on how the top program can help.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Here are the basic steps to use the top program:<\/p>\n\n\n\n<p>Open a terminal or command prompt.<br>Type &#8220;top&#8221; and press Enter.<br>The top program will display a list of processes, ordered by their CPU usage.<\/p>\n\n\n\n<p>The default display contains two areas of information: the summary area (or dashboard), and the task area (or process list). By default,\u00a0<code>top<\/code>\u00a0updates its display every three seconds\u2014you\u2019ll notice a slight flicker when it does.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-11-17.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"565\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-11-17-1024x565.png\" alt=\"\" class=\"wp-image-8549\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-11-17-1024x565.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-11-17-300x165.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-11-17-768x423.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-11-17.png 1217w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>The third line displays the following central processing unit (CPU) values:<\/p>\n\n\n\n<p>us: Amount of time the CPU spends executing processes for people in \u201cuser space.\u201d<br>sy: Amount of time spent running system \u201ckernel space\u201d processes.<br>ni: Amount of time spent executing processes with a manually set nice value.<br>id: Amount of CPU idle time.<br>wa: Amount of time the CPU spends waiting for I\/O to complete.<br>hi: Amount of time spent servicing hardware interrupts.<br>si: Amount of time spent servicing software interrupts.<br>st: Amount of time lost due to running virtual machines (\u201csteal time\u201d).<br>The fourth line shows the total amount (in kibibytes) of physical memory, and how much is free, used, and buffered or cached.<\/p>\n\n\n\n<p>The fifth line shows the total amount (also in kibibytes) of swap memory, and how much is free, used, and available. The latter includes memory that\u2019s expected to be recoverable from caches.<\/p>\n\n\n\n<p>The column headings in the process list are as follows:<\/p>\n\n\n\n<p>PID: Process ID.<br>USER: The owner of the process.<br>PR: Process priority.<br>NI: The nice value of the process.<br>VIRT: Amount of virtual memory used by the process.<br>RES: Amount of resident memory used by the process.<br>SHR: Amount of shared memory used by the process.<br>S: Status of the process. (See the list below for the values this field can take).<br>%CPU: The share of CPU time used by the process since the last update.<br>%MEM: The share of physical memory used.<br>TIME+: Total CPU time used by the task in hundredths of a second.<br>COMMAND: The command name or command line (name + options).<br>Memory values are shown in kibibytes. The COMMAND column is off-screen, to the right\u2014it didn\u2019t fit in the image above, but we\u2019ll see it shortly.<\/p>\n\n\n\n<p>The status of the process can be one of the following:<\/p>\n\n\n\n<p>D: Uninterruptible sleep<br>R: Running<br>S: Sleeping<br>T: Traced (stopped)<br>Z: Zombie<br>Press Q to exit top.<\/p>\n\n\n\n<p><strong>Scrolling the Display<\/strong><\/p>\n\n\n\n<p>You can press the Up or Down Arrows, Home, End, and Page Up or Down keys to move up and down and access all the processes.<\/p>\n\n\n\n<p>Press the Left or Right Arrow to move the process list sideways. This is useful to see any columns that don\u2019t fit within the confines of the terminal window.<\/p>\n\n\n\n<p>To sort the processes by other criteria, such as memory usage or process ID, press the corresponding key on your keyboard (M for memory, P for PID, etc.).<\/p>\n\n\n\n<p>Here is top with the &#8220;M&#8221; Key for Memory<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-13-07.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"567\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-13-07-1024x567.png\" alt=\"\" class=\"wp-image-8551\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-13-07-1024x567.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-13-07-300x166.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-13-07-768x425.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-13-07.png 1214w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>Press capital E to cycle through the units used to display memory values in these options: kibibytes, mebibytes, gibibytes, tebibytes, pebibytes, and exbibytes. The unit in use is the first item on lines four and five.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-31-35.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"565\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-31-35-1024x565.png\" alt=\"\" class=\"wp-image-8557\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-31-35-1024x565.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-31-35-300x166.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-31-35-768x424.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-31-35.png 1218w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>Press lowercase \u201ce\u201d to do the same thing for the values in the process list: kibibytes, mebibytes, gibibytes, tebibytes, and pebibytes.<\/p>\n\n\n\n<p><strong>Color and Highlighting<\/strong><\/p>\n\n\n\n<p>You can press \u201cz\u201d to add color to the display.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-38-30.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"565\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-38-30-1024x565.png\" alt=\"\" class=\"wp-image-8559\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-38-30-1024x565.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-38-30-300x166.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-38-30-768x424.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-14-08-38-30.png 1217w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>Press \u201cy\u201d to highlight running tasks in the process list. Pressing \u201cx\u201d highlights the column used to sort the process list. You can toggle between bold and reversed text highlighting by pressing \u201cb.\u201d<\/p>\n\n\n\n<p>Sorting by Columns<br>By default, the process list is sorted by the %CPU column. You can change the sort column by pressing the following:<\/p>\n\n\n\n<p>P: The %CPU column.<br>M: The %MEM column.<br>N: The PID column.<br>T: The TIME+ column.<\/p>\n\n\n\n<p><strong>Renice a Process<\/strong><\/p>\n\n\n\n<p>You can press \u201cr\u201d to change the nice value (priority) for a process. You\u2019ll be prompted for the process ID. Just press Enter to use the process ID of the task at the top of the process window. We type 7800, which happens to be the process ID of an instance of Firefox.<\/p>\n\n\n\n<p><strong>Kill a Process<\/strong><\/p>\n\n\n\n<p>Press \u201ck\u201d to kill a process. You\u2019ll then be prompted for the process ID you want to kill. In fact, you can send any signal to the process. We\u2019re going to kill process 7879, which has stopped responding.<\/p>\n\n\n\n<p><strong>Quit<\/strong><\/p>\n\n\n\n<p>To quit the top program, press the &#8220;q&#8221; key.<br>You can also use the top program with command-line options to customize its output, such as changing the update interval or sorting criteria. You can refer to the top program&#8217;s manual page (&#8220;man top&#8221;) for more information.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The top program is a command-line tool that shows system resource utilization, processes running, and their related information. It can be used in a terminal or command prompt. Let&#8217;s dig in to see more option on how the top program can help.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[],"class_list":["post-8548","post","type-post","status-publish","format-standard","hentry","category-kb"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/8548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=8548"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/8548\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=8548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=8548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=8548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}