How to analyze top command like a pro?
Tags: linux, performance, tutorial, systems
Published: 2021-06-28 14:33:18

<!-- wp:paragraph -->
<p>In this blog article, we are going to see how to analyze <code>top</code> command like a pro. I am learning Linux extensively from past couple of years which is helping me to learn more several Linux based tools. One of the frequent command is <code>top</code> among system administratots and engineers.</p>
<!-- /wp:paragraph -->

<!-- wp:generateblocks/headline {"uniqueId":"bbadc8ae"} -->
<h2 class="gb-headline gb-headline-bbadc8ae gb-headline-text">What is <code>top</code> command?</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:paragraph -->
<p><code>top</code> command displays the Linux processes on the host. Here is the definition from the manual:</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p>The 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<br>or threads currently being managed by the Linux kernel. The types of system summary information shown and the types, order and size of information displayed for processes are all user configurable and that configuration can be made persistent across restarts.</p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>Engineers use <code>top</code> mostly to view the list of processes, its CPU and memory usage and other details.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Here is the screenshot of my Raspberry Pi processes:</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8430,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/06/image-1.png"><img src="https://qainsights.com/wp-content/uploads/2021/06/image-1-1024x724.png" alt="" class="wp-image-8430"/></a></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>It displays the processes in a table format with several columns as shown above.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>You can type <code>h</code> to view the shortcuts which will help you to navigate. E.g. if you type <code>m</code> which will display the memory info at the top.</p>
<!-- /wp:paragraph -->

<!-- wp:generateblocks/headline {"uniqueId":"e1524eae"} -->
<h2 class="gb-headline gb-headline-e1524eae gb-headline-text">How to analyze top command like a pro?</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:paragraph -->
<p>If you are getting started with Linux and would like to analyze the top command, going thru in the table view might be overwhelming. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>I will share you the cool tool from yCrash which will help you to deep-dive into your <code>top</code> metrics.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Copy your <code>top</code> command output to the clipboard and launch https://ycrash.io/yc-top-analyzer.jsp</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Paste the <code>top</code> command output and then click on <code>Analyze</code> button as shown below.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8432,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/06/image-3.png"><img src="https://qainsights.com/wp-content/uploads/2021/06/image-3-1024x605.png" alt="" class="wp-image-8432"/></a></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Once you click on <code>Analyze</code>, <code>top command Analyzer</code> will give you a unique URL like this https://ycrash.io/yc-report-top-public.jsp?ou=yc-public&amp;de=1.1.1.1&amp;ts=2021-06-26T20-28-2&amp;app=top-app</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The tool will analyze the metrics and present it a neat format. In my case, I have got two issues: &nbsp;<strong>Free memory is less than 5% of total memory</strong> and &nbsp;<strong>Used swap memory is more than 10% of total memory</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":8433,"sizeSlug":"large","linkDestination":"media"} -->
<figure class="wp-block-image size-large"><a href="https://qainsights.com/wp-content/uploads/2021/06/image-4.png"><img src="https://qainsights.com/wp-content/uploads/2021/06/image-4-1024x519.png" alt="" class="wp-image-8433"/></a></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>The <code>top</code> report will display the pie chart, bar chart, and a tabular view of the processes. There are relevant help links for each panel which will help you to learn further.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>As you see, analyzing the <code>top</code> command output is quick and easy using this cool tool. Please give it a try and let me know if you have any questions.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Here is a tip, if you want something fancy you can install <code>htop</code> tool.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8435,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/06/image-6.png"><img src="https://qainsights.com/wp-content/uploads/2021/06/image-6-1024x485.png" alt="" class="wp-image-8435"/></a></figure></div>
<!-- /wp:image -->