{"id":798,"date":"2024-02-28T17:47:59","date_gmt":"2024-02-28T17:47:59","guid":{"rendered":"https:\/\/vickistan.com\/?p=798"},"modified":"2024-05-14T15:14:11","modified_gmt":"2024-05-14T15:14:11","slug":"the-top-htop-commands","status":"publish","type":"post","link":"https:\/\/vickistan.com\/?p=798","title":{"rendered":"The top\/htop command(s)"},"content":{"rendered":"\n<p><code>top<\/code> and <code>htop<\/code> are free CLI process viewers. They list the top resource using processes being run.The information includes:<br \/><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>PID <\/strong>&#8212;&nbsp;Process Id The task&#8217;s unique process ID<\/li>\n\n\n\n<li><strong>PPID<\/strong> &#8212;&nbsp;Parent Process PID (Process ID) of a task&#8217;s parent<\/li>\n\n\n\n<li><strong>RUSER<\/strong> &#8212;&nbsp;Real User NameThe real user name of the task&#8217;s owner&nbsp;<\/li>\n\n\n\n<li><strong>UID<\/strong> &#8212;&nbsp;User IdThe effective user ID of the task&#8217;s owner<\/li>\n\n\n\n<li><strong>USER<\/strong> &#8212;&nbsp;User NameThe effective user name of the task&#8217;s owner<\/li>\n\n\n\n<li><strong>GROUP<\/strong> &#8212;&nbsp;Group NameThe effective group name of the task&#8217;s owner.<\/li>\n\n\n\n<li><strong>NI<\/strong> &#8212;&nbsp;Nice value The nice value of the task. A negative nice value means higher priority, whereas a positive nice value means lower priority. Zero in this field simply means priority will not be adjusted.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p> <code>top<\/code> options:<br \/>&#8211;<strong>a<\/strong>&nbsp;:&nbsp;<strong>Sort by memory usage<\/strong> This switch makes top to sort the processes by allocated memory<br \/>&#8211;<strong>d<\/strong>&nbsp;:&nbsp;<strong>Delay time<\/strong>&nbsp;update interval as:&nbsp;<strong>-d ss.tt<\/strong>&nbsp;(<em>seconds<\/em>.<em>tenths<\/em>)<br \/>&#8211;<strong>p<\/strong>&nbsp;:&nbsp;<strong>Monitor PIDs<\/strong>&nbsp;as:&nbsp;<strong>-pN1 -pN2 &#8230;<\/strong>&nbsp;or&nbsp;<strong>-pN1, N2 [,&#8230;]<\/strong><br \/>&#8211;<strong>u<\/strong>&nbsp;:&nbsp;<strong>&lt;somebody&gt;<\/strong> Monitor only processes with an effective UID or user name matching <strong>&lt;somebody&gt;<\/strong>.<br \/><code>htop<\/code> options:<br \/><strong>-u &#8211;user=USERNAME<\/strong> Show only the processes of a given user<br \/><strong>-d &#8211;delay=DELAY<\/strong> Delay between updates, in tenths of seconds<br \/><\/p>\n\n\n\n<p><strong>Examples<\/strong>:<br \/><br \/>To run top in batch mode (updating every 3 seconds) and write it to a file in my directory<br \/><code>top -b -d 10 -n 3 >> \/home\/&lt;user>\/top-file<\/code><br \/><br \/>To run htop to get only processes for my user:<br \/><code>htop -u &lt;user><\/code><br \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>top and htop are free CLI process viewers. They list the top resource using processes being run.The information includes: top options:&#8211;a&nbsp;:&nbsp;Sort by memory usage This switch makes top to sort the processes by allocated memory&#8211;d&nbsp;:&nbsp;Delay time&nbsp;update interval as:&nbsp;-d ss.tt&nbsp;(seconds.tenths)&#8211;p&nbsp;:&nbsp;Monitor PIDs&nbsp;as:&nbsp;-pN1 &hellip; <a href=\"https:\/\/vickistan.com\/?p=798\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-798","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/posts\/798","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vickistan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=798"}],"version-history":[{"count":4,"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/posts\/798\/revisions"}],"predecessor-version":[{"id":835,"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/posts\/798\/revisions\/835"}],"wp:attachment":[{"href":"https:\/\/vickistan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vickistan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vickistan.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}