Linux Top: Here’s How to Customize It

Above Order – Referred to as below Linux Top – is a command on Unix and Unix-like systems, such as Linux, that provides a dynamic real-time overview of a running system. It can display system summary information and a list of processes or threads currently being managed by the Linux kernel. The type of system summary information shown by the Linux top command and the order and size of the information displayed are all user-configurable, and configuration changes can be made persistently across restarts.

Of course, sometimes, you have to dig a little deeper than Linux top command. Specifically for application performance monitoring, log analytics, etc. Please see some of the solutions in my 100 Top Server Monitoring and Application Performance Monitoring (APM) solutions list. See also: up, glance, htop.

Linux top command provides an interactive interface for process manipulation and a more comprehensive interface for individual configuration that covers almost every aspect of its operation.

Customizing Linux’s Top Commands: Getting Started

Default Linux apex (procps -ng) version 3.3.10 - CentOS 7.3

To run Linux top, type Above from command line. By default, the Linux top command will look similar to the above screenshot. To optimize, let’s start by pushing the memory scale I (Shift + E) and I then save the changes using woo (Shift + W) and continue from there:

I:extend-memory-scale to summary area – With this command, you can cycle through the available summary area memory scaling, which ranges from KiB (kibibytes or 1,024 bytes) to EiB (exabibytes or 1,152,921,504,606,846,976 bytes) . If you see a `+’ between a displayed number and the bottom label, it means the top was forced to cut off some part of that number. Such erosion can be avoided by increasing the scaling factor.

I:extend-memory-scale in task windows – With this command, you can cycle through the available task window memory scaling, which ranges from KiB (kibibytes or 1,024 bytes) to PiB (pebibytes or 1,125,899,906,842,624 bytes) . While vertex will attempt to respect the selected target range, additional scaling may still be necessary to accommodate current values. If you want to see more homogeneous results in the memory column, increasing the scaling range will accomplish that goal. However, increasing it too high is likely to produce an all-zero result, which cannot be suppressed. 0 (not numeric characters) interactive commands.

Next, when monitoring MySQL, Apache (and/or Nginx), and other threaded software. It might be useful to add a column for the number of threads (nTH). you can use it field management,

F , F:field-management – These keys display a separate screen where you can change which fields are displayed, their order, and also specify the sort field. I’ve added PPID (parent process id), changeAnd NTH.

Here are the other customization options I’ve used:

C:command-line/program-name toggle
This order will be respected whether the COMMAND column is currently visible or not. Later, whether that area should come into focus; The change you applied will be visible.

F , F: field management
These keys display a separate screen where you can change which fields are displayed, their order, and also specify the sort field. For additional information about these interactive commands,
See topic 3b. Management area.

1:single/separate-cpu-states toggle
This command affects how the CPU states portion of the ‘t’ command is displayed. While this toggle exists primarily to serve massively parallel SMP machines, it is not limited to SMP environments. When you see `%Cpu(s):’ in the Summary area, the `1 toggle is on, and all CPU information is collected in one line. Otherwise, each CPU is displayed separately: `%Cpu0, %Cpu1, …’ to the available screen height.

b:bold/reverse toggle
This command will affect how the ‘x’ and ‘y’ toggles are displayed. It can also affect the summary area when bar graphs have been selected for CPU states or memory usage. Tea either M toggle.

x:column-highlight toggle
Highlighting changes for the current sort field. If you forget which field is being sorted, this command can serve as a quick visual reminder, provided that the sort field is being displayed. The sort field cannot be visible because 1) There is insufficient screen width 2) The `f’ interactive command turned it off. Note: Whenever searching and/or other filtering is activated in a window, column highlighting is temporarily disabled. See notes at the end of 5d topics. Search and 5e. filtering for one Explanation why.

You:row-highlight toggle
Highlighting changes for “running” tasks. For additional insight into this work situation, see topic 3a. Description of fields, ‘S’ field (process status). Using this provision provides important insights about the health of your system. There will be only a few extra TTY escape sequences.

With: color/monochrome toggle
The `current’ window switches between your last used color scheme and the old form of black-on-white or white-on-black. This command will change both the summary area and the work area but does not affect the position of the ‘x,’ ‘y,’ or ‘b’ toggle.

I:idle-process toggle
Displays all tasks or only active tasks. When this toggle is off, tasks that haven’t used any CPU since the last update will not be displayed. However, due to the granularity of the %CPU and TIME+ fields, some processes may still display what appears to be no CPU usage. If this command is applied to the last task display in alternate-display mode, it will not affect the window size, as all prior task performance will have already been painted.

from:change-color-mapping
This key will take you to a different screen where you can change the color for the ‘current’ window or all windows.

woo:right-the-config-file
This will save all your options and toggles as well as the current display mode and delay time. By issuing this command just before quitting top, you’ll be able to restart afterwards in exactly the same way
same state.

You can continue to customize by reading the full Linux top man page using the command: man top, Where you will find additional tips such as filtering Linux top command output by user. you can start with the top top-you entertainer, you can also press h While looking at the top to open the “Help for Interactive Commands” screen. This post should serve as a quick guide to encourage you to explore customization, so you can get the most out of Linux top commands! Below, or at the top of this post (using color), you can see the result of Linux Top Tweaks:

Linux Apex - After Customization

How to go back/start with the default Linux top?

when you save using woo, Notice Top will display the path of the file created to save the custom settings. You can empty, move, or delete that file to start over again. For example, in my case:

mv ~/.toprc ~/.toprc_bk

If you don’t care to restore from that fine, you can remove it with:

rm ~/.toprc

reference: man top,

Originally Published: September 8, 2017
Last Updated: November 11, 2020

Leave a Comment