Can we get specific column in a top command, for eg I'm interested in only the memory utilization and CPU usage column.
How do I reduce the displayed columns of the top command to only the above two columns?
columnstop
Can we get specific column in a top command, for eg I'm interested in only the memory utilization and CPU usage column.
How do I reduce the displayed columns of the top command to only the above two columns?
Best Answer
NOTE: Assuming you have this version of
top
(procps). You can check with this command:procps is often the version of
top
included with Fedora/CentOS/RHEL and other variants.Changing columns
If you look in the man page for
top
you'll see a section titled: "2b. SELECTING and ORDERING Columns". There are keyboard shortcuts for toggling visibility for the different fields/columns.For example:
You can use the key f while in
top
to get to a secondary screen where you can specify which columns should be toggled visible or not:For example:
There are more, these are just a sample. When you're done toggling the columns the way you want, use the Esc to get out of the selection screen.
Saving configuration
You can use the Shift+W to save your changes so they're the defaults:
The file is stored here,
$HOME/.toprc
, and looks like this:See section 5 of the man page for more details, "5. FILES".