How do I get "top" command to wrap its output?

The command field is by default truncated automatically for better reading.

You need to run

top -c

to show full command then depending on your console window's capabilities you would be able to scroll to right and see full command.


top -bcn1 -w512

The elegant solution is to use the option -w [number]. According to the man page, the maximum width is 512 characters, so you will need a different solution for anything exceeding that. Presumably you also want to see the full length of the commands, so use the -c option. We need to run top in "batch mode", -b, or it will continue to cut off the commands with a "+". Batch mode kind of makes a mess because it prints out all the jobs every second, so we can use the -n1 option to print out just one instance.

See the man top page for more information.


As Daniel Arndt said, you can also use htop instead of top. It's available on all distro nowadays, and it provides better numbers (especially for memory usage)

It is also far easier to use and nicer to see, even if it's limited to terminal's colors. You can scroll to the right in order to see the full command, for instance, or you can kill a process with a simple F9. You can also see full tree with 't' key.

Tags:

Linux

Top