{"id":63077,"date":"2022-03-21T09:01:23","date_gmt":"2022-03-21T09:01:23","guid":{"rendered":"https:\/\/www.cryptocabaret.com\/?p=63077"},"modified":"2022-03-21T09:01:23","modified_gmt":"2022-03-21T09:01:23","slug":"my-favorite-linux-top-command-options","status":"publish","type":"post","link":"https:\/\/www.cryptocabaret.com\/?p=63077","title":{"rendered":"My favorite Linux top command options"},"content":{"rendered":"<p><span class=\"field field--name-title field--type-string field--label-hidden\">My favorite Linux top command options<\/span><br \/>\n<span class=\"field field--name-uid field--type-entity-reference field--label-hidden\"><a title=\"View user profile.\" href=\"https:\/\/opensource.com\/users\/don-watkins\" class=\"username\">Don Watkins<\/a><\/span><br \/>\n<span class=\"field field--name-created field--type-created field--label-hidden\">Mon, 03\/21\/2022 &#8211; 03:00<\/span><\/p>\n<div data-drupal-selector=\"rate-node-69721\" class=\"rate-widget-thumbs-up\">\n<div class=\"rate-thumbs-up-btn-up rate-thumbs-up-btn-up vote-pending\">Up<\/div>\n<div class=\"rate-score\"><a href=\"https:\/\/opensource.com\/user\/register?absolute=1\">Register<\/a> or <a href=\"https:\/\/opensource.com\/user\/login?current=\/rss.xml&amp;absolute=1\">Login<\/a> to like.<\/div>\n<\/div>\n<div class=\"clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item\">\n<p>When I am checking out Linux systems (or even troubleshooting computers running other operating systems), I frequently use the <code>top<\/code> command to check out the system&#8217;s RAM and CPU utilization. It provides me with information to assess the computer&#8217;s overall health. I learned about the <code>top<\/code> command early in my Linux journey and have relied on it to give me a quick overview of what is happening on servers or other Linux systems, including Raspberry Pi. According to its man page, the <em>top program provides 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<\/em>.<\/p>\n<p>A quick overview is often all I need to determine what is going on with the system in question. But there is so much more to the <code>top<\/code> command than meets the eye. Specific features of your <code>top<\/code> command may vary depending on whose version (procps-ng, Busybox, BSD) you run, so consult the man page for details.<\/p>\n<p>To launch <code>top<\/code>, type it into your terminal:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"bash geshifilter-bash\"><span class=\"co4\">$ <\/span>top<\/code><\/span><\/pre>\n<p>Running processes are displayed below the table heading on the <code>top<\/code> screen, and system statistics are shown above it.<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\">Top 05:<span class=\"nu0\">31<\/span>:09 up <span class=\"nu0\">55<\/span> min,<span class=\"nu0\">3<\/span> <span class=\"kw2\">users<\/span>,load average: <span class=\"nu0\">0.54<\/span>, <span class=\"nu0\">0.38<\/span>, <span class=\"nu0\">0.46<\/span><br>\nTasks: <span class=\"nu0\">469<\/span> total, <span class=\"nu0\">1<\/span> running, <span class=\"nu0\">468<\/span> sleeping, \u00a0<span class=\"nu0\">0<\/span> stopped, <span class=\"nu0\">0<\/span> zombie<br><span class=\"sy0\">%<\/span>Cpu<span class=\"br0\">(<\/span>s<span class=\"br0\">)<\/span>: <span class=\"nu0\">1.0<\/span> us, <span class=\"nu0\">0.4<\/span> sy, <span class=\"nu0\">0.0<\/span> ni, <span class=\"nu0\">98.6<\/span> <span class=\"kw2\">id<\/span>, <span class=\"nu0\">0.1<\/span> wa, <span class=\"nu0\">0.0<\/span> hi,<span class=\"nu0\">0.0<\/span> si,<span class=\"nu0\">0.0<\/span> st<br>\nMiB Mem : <span class=\"nu0\">32116.1<\/span> total, \u00a0<span class=\"nu0\">20256.5<\/span> <span class=\"kw2\">free<\/span>, <span class=\"nu0\">6376.3<\/span> used, <span class=\"nu0\">5483.3<\/span> buff<span class=\"sy0\">\/<\/span>cache<br>\nMiB Swap: <span class=\"nu0\">0.0<\/span> total, \u00a0<span class=\"nu0\">0.0<\/span> <span class=\"kw2\">free<\/span>, \u00a0 \u00a0 \u00a0<span class=\"nu0\">0.0<\/span> used. \u00a0<span class=\"nu0\">25111.4<\/span> avail Mem \u00a0<br><br>\n\u00a0PID USER \u00a0PR NI \u00a0 VIRT \u00a0 \u00a0RES \u00a0 SHR S <span class=\"sy0\">%<\/span>CPU <span class=\"sy0\">%<\/span>MEM \u00a0 \u00a0TIME+ COMMAND \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <br><span class=\"nu0\">2566<\/span> don \u00a0 <span class=\"nu0\">20<\/span> \u00a0<span class=\"nu0\">0<\/span> \u00a011.9g <span class=\"nu0\">701300<\/span> <span class=\"nu0\">78848<\/span> S \u00a0<span class=\"nu0\">3.3<\/span> \u00a0<span class=\"nu0\">2.1<\/span> \u00a0<span class=\"nu0\">2<\/span>:<span class=\"nu0\">03.80<\/span> firefox-bin<br><span class=\"nu0\">1606<\/span> don \u00a0 <span class=\"nu0\">20<\/span> \u00a0<span class=\"nu0\">0<\/span> \u00a024.2g \u00a0<span class=\"nu0\">88084<\/span> \u00a0<span class=\"nu0\">4512<\/span> S \u00a0<span class=\"nu0\">2.0<\/span> \u00a0<span class=\"nu0\">0.3<\/span> \u00a0<span class=\"nu0\">0<\/span>:<span class=\"nu0\">39.59<\/span> elisa<br><span class=\"nu0\">1989<\/span> don \u00a0 <span class=\"nu0\">20<\/span> \u00a0<span class=\"nu0\">0<\/span> <span class=\"nu0\">894236<\/span> <span class=\"nu0\">201580<\/span> <span class=\"nu0\">23536<\/span> S \u00a0<span class=\"nu0\">2.0<\/span> \u00a0<span class=\"nu0\">0.6<\/span> \u00a0<span class=\"nu0\">0<\/span>:<span class=\"nu0\">46.12<\/span> stopgo-java<br><span class=\"nu0\">5483<\/span> don \u00a0 <span class=\"nu0\">20<\/span> \u00a0<span class=\"nu0\">0<\/span> \u00a024.5g <span class=\"nu0\">239200<\/span> <span class=\"nu0\">20868<\/span> S \u00a0<span class=\"nu0\">1.3<\/span> \u00a0<span class=\"nu0\">0.7<\/span> \u00a0<span class=\"nu0\">0<\/span>:<span class=\"nu0\">26.54<\/span> Isolated Web Co<br><span class=\"nu0\">5726<\/span> don \u00a0 <span class=\"nu0\">20<\/span> \u00a0<span class=\"nu0\">0<\/span> <span class=\"nu0\">977252<\/span> <span class=\"nu0\">228012<\/span> <span class=\"nu0\">44472<\/span> S \u00a0<span class=\"nu0\">1.3<\/span> \u00a0<span class=\"nu0\">0.7<\/span> \u00a0<span class=\"nu0\">0<\/span>:<span class=\"nu0\">41.25<\/span> pulseaudio<\/div><\/div><\/pre>\n<p>Press the <strong>Z<\/strong> key to change the color of the output. I find this makes the output a little easier on the eyes.<\/p>\n<p>Press the <strong>1<\/strong> key to see a graphical representation of each CPU core on the system. Press <strong>1<\/strong> repeatedly to assess core statistics for your CPU cores.<\/p>\n<p>You can display memory usage graphically by invoking the <code>top<\/code> command and then pressing the <strong>m<\/strong> key.<\/p>\n<\/p>\n<div class=\"embedded-resource-list callout-float-right\">\n<div class=\"field field--name-title field--type-string field--label-hidden field__item\">More Linux resources<\/div>\n<div class=\"field field--name-links field--type-link field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/developers.redhat.com\/cheat-sheets\/linux-commands-cheat-sheet\/?intcmp=70160000000h1jYAAQ\">Linux commands cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/developers.redhat.com\/cheat-sheets\/advanced-linux-commands\/?intcmp=70160000000h1jYAAQ\">Advanced Linux commands cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/www.redhat.com\/en\/services\/training\/rh024-red-hat-linux-technical-overview?intcmp=70160000000h1jYAAQ\">Free online course: RHEL technical overview<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/cheat-sheet-networking?intcmp=70160000000h1jYAAQ\">Linux networking cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/cheat-sheet-selinux?intcmp=70160000000h1jYAAQ\">SELinux cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/linux-common-commands-cheat-sheet?intcmp=70160000000h1jYAAQ\">Linux common commands cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/resources\/what-are-linux-containers?intcmp=70160000000h1jYAAQ\">What are Linux containers?<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/linux?intcmp=70160000000h1jYAAQ\">Our latest Linux articles<\/a><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<h2>Useful top options<\/h2>\n<p>If you&#8217;re looking only for the processes started by a specific user, you can get that information with the <code>-u<\/code> option:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"bash geshifilter-bash\"><span class=\"co4\">$ <\/span>top <span class=\"re5\">-u<\/span> <span class=\"st_h\">'username'<\/span><\/code><\/span><\/pre>\n<p>To get a list of idle processes on your system, use the <code>-i<\/code> option:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"bash geshifilter-bash\"><span class=\"co4\">$ <\/span>top <span class=\"re5\">-i<\/span><\/code><\/span><\/pre>\n<p>You can set the update interval to an arbitrary value in seconds. The default value is three seconds. Change it to five like this:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"bash geshifilter-bash\"><span class=\"co4\">$ <\/span>top <span class=\"re5\">-d<\/span> <span class=\"nu0\">5<\/span><\/code><\/span><\/pre>\n<p>You can also run <code>top<\/code> on a timer. For instance, the following command sets the number of iterations to two and then exits:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"bash geshifilter-bash\"><span class=\"co4\">$ <\/span>top <span class=\"re5\">-n<\/span> <span class=\"nu0\">2<\/span><\/code><\/span><\/pre>\n<h2>Locate a process with top<\/h2>\n<p>Press <strong>Shift+L<\/strong> to locate a process by name. This creates a prompt just above the bold table header line. Type in the name of the process you&#8217;re looking for and then press <strong>Enter<\/strong> or <strong>Return<\/strong> to see the instances of that process highlighted in the newly sorted process list.<\/p>\n<h2>Stopping a process with top<\/h2>\n<p>You can stop or &#8220;kill&#8221; a running process with <code>top<\/code>, too. First, find the process you want to stop using either <strong>Shift+L<\/strong> or <code>pgrep<\/code>. Next, press <strong>K<\/strong> and enter the process ID you want to stop. The default value is whatever is at the top of the list, so be sure to enter the PID you want to stop before pressing <strong>Enter<\/strong>, or you may stop a process you didn&#8217;t intend to.<\/p>\n<article class=\"align-center media media--type-image media--view-mode-default\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/03\/top-results_0.png\" width=\"780\" height=\"210\" alt=\"top results\" loading=\"lazy\"><\/div>\n<\/article>\n<h2>Top top<\/h2>\n<p>There are many iterations of the <code>top<\/code> command, including <code>htop<\/code>, <code>atop<\/code>, <code>btop<\/code>, and <code>ttop<\/code>. There are specialized <code>top<\/code> commands, too, like <code>powertop<\/code> for power usage and <code>ntop<\/code> for networks. What&#8217;s your favorite <code>top<\/code>?<\/p>\n<\/div>\n<div class=\"clearfix text-formatted field field--name-field-article-subhead field--type-text-long field--label-hidden field__item\">\n<p>A quick overview is often all I need to determine what is going on with my Linux system. But there is so much more to the top command than meets the eye.<\/p>\n<\/div>\n<div class=\"field field--name-field-lead-image field--type-entity-reference field--label-hidden field__item\">\n<article class=\"media media--type-image media--view-mode-caption\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/03\/command_line_prompt.png\" width=\"518\" height=\"292\" alt=\"Command line prompt\" title=\"Command line prompt\" loading=\"lazy\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>Opensource.com<\/p>\n<\/div>\n<\/article>\n<\/div>\n<div class=\"field field--name-field-tags field--type-entity-reference field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/linux\" hreflang=\"en\">Linux<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/command-line\" hreflang=\"en\">Command line<\/a><\/div>\n<\/p><\/div>\n<div class=\"hidden field field--name-field-listicle-title field--type-string field--label-hidden field__item\">What to read next<\/div>\n<div class=\"field field--name-field-default-license field--type-list-string field--label-hidden field__item\"><a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\"><br \/>\n        <img decoding=\"async\" alt=\"Creative Commons License\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/03\/cc-by-sa-4-5.png\" title=\"This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.\"><\/a>This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.<\/div>\n<section class=\"field field--name-field-comments field--type-comment field--label-hidden comment-wrapper\">\n<div class=\"comments__count\">\n<div class=\"login\"><a href=\"https:\/\/opensource.com\/user\/register?absolute=1\">Register<\/a> or <a href=\"https:\/\/opensource.com\/user\/login?current=\/rss.xml&amp;absolute=1\">Login<\/a> to post a comment.<\/div>\n<\/p><\/div>\n<\/section>\n<p class=\"wpematico_credit\"><small>Powered by <a href=\"http:\/\/www.wpematico.com\" target=\"_blank\" rel=\"noopener\">WPeMatico<\/a><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>My favorite Linux top command options Don Watkins Mon, 03\/21\/2022 &#8211; 03:00 Up Register or Login to like. When I am checking out Linux systems (or even troubleshooting computers running other operating systems), I frequently use the top command to check out the system&#8217;s RAM and CPU utilization. It provides me with information to assess [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":63078,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[307],"tags":[],"class_list":["post-63077","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-open-source"],"_links":{"self":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/63077","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=63077"}],"version-history":[{"count":0,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/63077\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/media\/63078"}],"wp:attachment":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=63077"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=63077"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=63077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}