{"id":7210,"date":"2018-02-11T17:04:47","date_gmt":"2018-02-11T09:04:47","guid":{"rendered":"http:\/\/rmohan.com\/?p=7210"},"modified":"2018-02-11T17:05:18","modified_gmt":"2018-02-11T09:05:18","slug":"7210","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7210","title":{"rendered":"Top Show Running Processes"},"content":{"rendered":"<p>he Linux top command is used to show all the running processes within your <a href=\"https:\/\/www.lifewire.com\/best-linux-desktop-environments-4120912\" data-component=\"link\" data-source=\"inlineLink\" data-type=\"internalLink\" data-ordinal=\"1\">Linux environment<\/a>. This guide shows you how to use the top command by explaining the different switches available and the information that is displayed:<\/p>\n<h3>How To Run The Top Command<\/h3>\n<p>In its basic form all you need to do to show the current processes is type the following in a <a href=\"https:\/\/www.lifewire.com\/linux-terminal-commands-rock-your-world-2201165\" data-component=\"link\" data-source=\"inlineLink\" data-type=\"internalLink\" data-ordinal=\"2\">Linux terminal<\/a>:<\/p>\n<blockquote><p>top<\/p><\/blockquote>\n<h3>What Information Is Shown:<\/h3>\n<p>The following information is displayed when you run the Linux top command:<\/p>\n<div id=\"billboard1-sticky_1-0\" class=\"comp billboard1-sticky billboard-sticky is-lockable\" data-height=\"1050\">\n<div class=\"spacer\">\n<div id=\"billboard1_1-0\" class=\"comp billboard1 mntl-gpt-adunit gpt billboard\" data-ad-width=\"300\" data-ad-height=\"600\">\n<div id=\"billboard\" class=\"wrapper\" data-google-query-id=\"CICm1oHAndkCFRWJaAodU3cAuA\">\n<div id=\"google_ads_iframe_\/479\/lifewire\/lw_learn-how-linux\/billboard_0__container__\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3>Line 1<\/h3>\n<ul>\n<li>The time<\/li>\n<li>How long the computer has been running<\/li>\n<li>Number of users<\/li>\n<li><a href=\"https:\/\/www.howtogeek.com\/194642\/understanding-the-load-average-on-linux-and-other-unix-like-systems\/\" target=\"_blank\" rel=\"nofollow noopener\" data-component=\"link\" data-source=\"inlineLink\" data-type=\"externalLink\" data-ordinal=\"3\">Load average<\/a><\/li>\n<\/ul>\n<p>The load average shows the system load time for the last 1, 5 and 15 minutes.<\/p>\n<h3>Line 2<\/h3>\n<ul>\n<li>Total number of tasks<\/li>\n<li>Number of running tasks<\/li>\n<li>Number of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Sleep_%28Unix%29\" target=\"_blank\" rel=\"noopener\" data-component=\"link\" data-source=\"inlineLink\" data-type=\"externalLink\" data-ordinal=\"4\">sleeping tasks<\/a><\/li>\n<li>Number of stopped tasks<\/li>\n<li>Number of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Zombie_process\" target=\"_blank\" rel=\"noopener\" data-component=\"link\" data-source=\"inlineLink\" data-type=\"externalLink\" data-ordinal=\"5\">zombie tasks<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>Line 3<\/h3>\n<ul>\n<li>CPU usage as a percentage by the user<\/li>\n<li>CPU usage as a percentage by system<\/li>\n<li>CPU usage as a percentage by low priority processes<\/li>\n<li>CPU usage as a percentage by <a href=\"http:\/\/duartes.org\/gustavo\/blog\/post\/what-does-an-idle-cpu-do\/\" target=\"_blank\" rel=\"nofollow noopener\" data-component=\"link\" data-source=\"inlineLink\" data-type=\"externalLink\" data-ordinal=\"6\">idle processes<\/a><\/li>\n<li>CPU usage as a percentage by <a href=\"http:\/\/blog.scoutapp.com\/articles\/2011\/02\/10\/understanding-disk-i-o-when-should-you-be-worried\" target=\"_blank\" rel=\"nofollow noopener\" data-component=\"link\" data-source=\"inlineLink\" data-type=\"externalLink\" data-ordinal=\"7\">io wait<\/a><\/li>\n<li>CPU usage as a percentage by <a href=\"https:\/\/www.lifewire.com\/linux-terminal-commands-rock-your-world-2201165\" data-component=\"link\" data-source=\"inlineLink\" data-type=\"internalLink\" data-ordinal=\"8\">hardware interrupts<\/a><\/li>\n<li>CPU usage as a percentage by software interrupts<\/li>\n<li>CPU usage as a percentage by <a href=\"http:\/\/blog.scoutapp.com\/articles\/2013\/07\/25\/understanding-cpu-steal-time-when-should-you-be-worried\" target=\"_blank\" rel=\"nofollow noopener\" data-component=\"link\" data-source=\"inlineLink\" data-type=\"externalLink\" data-ordinal=\"9\">steal time<\/a><\/li>\n<\/ul>\n<p><a href=\"http:\/\/itstillworks.com\/definition-cpu-usage-5076431.html\" target=\"_blank\" rel=\"nofollow noopener\" data-component=\"link\" data-source=\"inlineLink\" data-type=\"externalLink\" data-ordinal=\"10\">This guide gives a definition of what CPU usage means<\/a>.<\/p>\n<h3>Line 3<\/h3>\n<ul>\n<li>Total system memory<\/li>\n<li>Free memory<\/li>\n<li>Memory used<\/li>\n<li><a href=\"https:\/\/www.lifewire.com\/definition-of-cache-2483171\" data-component=\"link\" data-source=\"inlineLink\" data-type=\"internalLink\" data-ordinal=\"11\">Buffer cache<\/a><\/li>\n<\/ul>\n<h3>Line 4<\/h3>\n<ul>\n<li>Total swap available<\/li>\n<li>Total swap free<\/li>\n<li>Total swap used<\/li>\n<li>Available memory<\/li>\n<\/ul>\n<p><a href=\"https:\/\/www.lifewire.com\/do-you-need-swap-partition-2202049\" data-component=\"link\" data-source=\"inlineLink\" data-type=\"internalLink\" data-ordinal=\"12\">This guide gives a description of swap partitions and whether you need them.<\/a><\/p>\n<h3>Main Table<\/h3>\n<ul>\n<li>Process ID<\/li>\n<\/ul>\n<div id=\"native-placeholder_1-0\" class=\"comp native-placeholder mntl-block\"><\/div>\n<ul class=\"html-slice\">\n<li>User<\/li>\n<li>Priority<\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Nice_%28Unix%29\" target=\"_blank\" rel=\"noopener\" data-component=\"link\" data-source=\"inlineLink\" data-type=\"externalLink\" data-ordinal=\"13\">Nice level<\/a><\/li>\n<li>Virtual memory used by process<\/li>\n<li>Resident memory used by a process<\/li>\n<li>Shareable memory<\/li>\n<li>CPU used by process as a percentage<\/li>\n<li>Memory used by process as a percentage<\/li>\n<li>Time process has been running<\/li>\n<li>Command<\/li>\n<\/ul>\n<p><a href=\"https:\/\/www.lifewire.com\/pc-memory-speed-and-latency-832450\" data-component=\"link\" data-source=\"inlineLink\" data-type=\"internalLink\" data-ordinal=\"14\">Here is a good guide discussing computer memory<\/a>.<\/p>\n<h3>Keep Linux Top Running All The Time In The Background<\/h3>\n<p>You can keep the top command easily available without having to type the word top each time into your terminal window.<\/p>\n<div id=\"billboard2-sticky_1-0\" class=\"comp billboard2-sticky billboard-sticky is-lockable\" data-height=\"600\" data-parent=\"\">\n<div class=\"spacer\">\n<div id=\"billboard2-dynamic_1-0\" class=\"comp billboard2-dynamic mntl-gpt-dynamic-adunit mntl-gpt-adunit gpt billboard dynamic is-requested\" data-index=\"2\" data-ad-width=\"300\" data-ad-height=\"250\">\n<div id=\"billboard2\" class=\"wrapper\" data-type=\"billboard\" data-pos=\"btf1\" data-priority=\"3\" data-sizes=\"[[300, 250], [300, 600], [300, 601], [160, 600], [300, 251], [2, 1], 'fluid']\" data-rtb=\"true\" data-targeting=\"null\" data-google-query-id=\"CIami4LAndkCFc2haAodMqsHWQ\">\n<div id=\"google_ads_iframe_\/479\/lifewire\/lw_learn-how-linux\/billboard2_0__container__\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>To pause top so that you can continue using the terminal, press CTRL and Z on the keyboard.<\/p>\n<p>To bring top back to the foreground, type fg.<\/p>\n<h3>Key Switches For The Top Command:<\/h3>\n<ul>\n<li>-h &#8211; Show the current version<\/li>\n<li>-c &#8211; This toggles the command column between showing command and program name<\/li>\n<li>-d &#8211; Specify the delay time between refreshing the screen<\/li>\n<li>-o &#8211; Sorts by the named field<\/li>\n<li>-p &#8211; Only show processes with specified process IDs<\/li>\n<li>-u &#8211; Show only processes by the specified user<\/li>\n<li>-i &#8211; Do not show idle tasks<\/li>\n<\/ul>\n<h3>Show The Current Version<\/h3>\n<p>Type the following to show the current version details for top:<\/p>\n<blockquote><p>top -h<\/p><\/blockquote>\n<p>Output is in the form <strong>procps -ng version 3.3.10<\/strong><\/p>\n<h3>Specify A Delay Time Between Screen Refreshes<\/h3>\n<p>To specify a delay between the screen refreshes whilst using top type the following:<\/p>\n<blockquote><p>top -d<\/p><\/blockquote>\n<p>To refresh every 5 seconds type <strong>top -d 5<\/strong><\/p>\n<h3>Obtain A List Of Columns To Sort By<\/h3>\n<p>To get a list of the columns with which you can sort the top command by type the following:<\/p>\n<blockquote><p>top -O<\/p><\/blockquote>\n<p>There are a lot of columns so you might wish to pipe the output to less as follows:<\/p>\n<blockquote><p>top -O | less<\/p><\/blockquote>\n<h3>Sort The Columns In The Top Command By A Column Name<\/h3>\n<p>Use the previous section to find a column to sort by and then use the following syntax to sort by that column:<\/p>\n<blockquote><p>top -o<\/p><\/blockquote>\n<p>To sort by %CPU type the following:<\/p>\n<div id=\"billboard3-sticky_1-0\" class=\"comp billboard3-sticky billboard-sticky is-lockable\" data-height=\"600\" data-parent=\"\">\n<div class=\"spacer\">\n<div id=\"billboard3-dynamic_1-0\" class=\"comp billboard3-dynamic mntl-gpt-dynamic-adunit mntl-gpt-adunit gpt billboard dynamic is-requested\" data-index=\"3\" data-ad-width=\"300\" data-ad-height=\"250\">\n<div id=\"billboard3\" class=\"wrapper\" data-type=\"billboard\" data-pos=\"btf2\" data-priority=\"5\" data-sizes=\"[[300, 250], [300, 252], [3, 1], 'fluid']\" data-rtb=\"true\" data-targeting=\"null\" data-google-query-id=\"CIHX7YHAndkCFckjaAodEU8AVg\">\n<div id=\"google_ads_iframe_\/479\/lifewire\/lw_learn-how-linux\/billboard3_0__container__\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<blockquote><p>top -o %CPU<\/p><\/blockquote>\n<h3>Only Show The Processes For A Specific User<\/h3>\n<p>To show only the processes that a <a href=\"https:\/\/www.lifewire.com\/create-users-useradd-command-3572157\" data-component=\"link\" data-source=\"inlineLink\" data-type=\"internalLink\" data-ordinal=\"15\">specific user<\/a> is running use the following syntax:<\/p>\n<blockquote><p>top -u<\/p><\/blockquote>\n<p>For example to show all the processes that the user gary is running type the following:<\/p>\n<blockquote><p>top -u gary<\/p><\/blockquote>\n<h3>Hide Idle Tasks<\/h3>\n<p>The default top view can seem cluttered and if you want to see only active processes (i.e those that are not idle) then you can ran the top command using the following command:<\/p>\n<blockquote><p>top -i<\/p><\/blockquote>\n<h3>Adding Extra Columns To The Top Display<\/h3>\n<p>Whilst running top you can press the &#8216;F&#8217; key which shows the list of fields that can be displayed in the table:<\/p>\n<p>Use the arrow keys to move up and down the list of fields.<\/p>\n<p>To set a field so that it is displayed on the screen press the &#8216;D&#8217; key. To remove the field press &#8220;D&#8221; on it again. An asterisk (*) will appear next to displayed fields.<\/p>\n<p>You can set the field to sort the table by simply by pressing the &#8220;S&#8221; key on the field you wish to sort by.<\/p>\n<p>Press the enter key to commit your changes and press &#8220;Q&#8221; to quit.<\/p>\n<h3>Toggling Modes<\/h3>\n<p>Whilst running top you can press the &#8220;A&#8221; key to toggle between the standard display and an alternate display.<\/p>\n<h3>Changing Colors<\/h3>\n<p>Press the &#8220;Z&#8221; key to change the colors of the values within top.<\/p>\n<p>There are three stages required to change the colors:<\/p>\n<ol>\n<li>Press either S for summary data, M for messages, H for column headings or T for task information to target that area for a color change<\/li>\n<li>Choose a color for that target, 0 for black, 1 for red, 2 for green, 3 for yellow, 4 for blue, 5 for magenta, 6 for cyan and 7 for white<\/li>\n<li>Enter to commit<\/li>\n<\/ol>\n<p>Press the &#8220;B&#8221; key to make text bold.<\/p>\n<h3>Change The Display Whilst Running Top<\/h3>\n<p>Whilst the top command is running you can toggle many of the features on and off by pressing relevant keys whilst it is running.<\/p>\n<p>The following table shows the key to press and the function it provides:<\/p>\n<table border=\"1\" cellspacing=\"1\" cellpadding=\"1\">\n<caption>Function Keys<\/caption>\n<thead>\n<tr>\n<th>Function Key<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>A<\/td>\n<td>Alternative display (default off)<\/td>\n<\/tr>\n<tr>\n<td>d<\/td>\n<td>Refresh screen after specified delay in seconds (default 1.5 seconds)<\/td>\n<\/tr>\n<tr>\n<td>H<\/td>\n<td>Threads mode (default off), summarises tasks<\/td>\n<\/tr>\n<tr>\n<td>p<\/td>\n<td>PID Monitoring (default off), show all processes<\/td>\n<\/tr>\n<tr>\n<td>B<\/td>\n<td>Bold enable (default on), values are shown in bold text<\/td>\n<\/tr>\n<tr>\n<td>l<\/td>\n<td>Display load average (default on)<\/td>\n<\/tr>\n<tr>\n<td>t<\/td>\n<td>Determines how tasks are displayed (default 1+1)<\/td>\n<\/tr>\n<tr>\n<td>m<\/td>\n<td>Determines how memory usage is displayed (default 2 lines)<\/td>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>Single cpu (default off) &#8211; i.e. shows for multiple CPUs<\/td>\n<\/tr>\n<tr>\n<td>J<\/td>\n<td>Align numbers to the right (default on)<\/td>\n<\/tr>\n<tr>\n<td>j<\/td>\n<td>Align text to the right (default off)<\/td>\n<\/tr>\n<tr>\n<td>R<\/td>\n<td>Reverse sort (default on) &#8211; Highest processes to lowest processes<\/td>\n<\/tr>\n<tr>\n<td>S<\/td>\n<td>Cumulative time (default off)<\/td>\n<\/tr>\n<tr>\n<td>u<\/td>\n<td>User filter (default off) show euid only<\/td>\n<\/tr>\n<tr>\n<td>U<\/td>\n<td>User filter (default off) show any uid<\/td>\n<\/tr>\n<tr>\n<td>V<\/td>\n<td>Forest view (default on) show as branches<\/td>\n<\/tr>\n<tr>\n<td>x<\/td>\n<td>Column highlight (default off)<\/td>\n<\/tr>\n<tr>\n<td>z<\/td>\n<td>Color or mono (default on) show colors<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Summary<\/h3>\n<p>There are more switches available and you can read more about them by typing the following into your terminal window:<\/p>\n","protected":false},"excerpt":{"rendered":"<p>he Linux top command is used to show all the running processes within your Linux environment. This guide shows you how to use the top command by explaining the different switches available and the information that is displayed:<\/p>\n<p> How To Run The Top Command <\/p>\n<p>In its basic form all you need to do to show [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7210"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7210"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7210\/revisions"}],"predecessor-version":[{"id":7212,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7210\/revisions\/7212"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}