Linux – How to get “top” command to wrap its output

linuxtop

The "command" column gets truncated by the width of the screen and I am unable to see the last part of it.

I have tried to reduce the font size so I can see a longer part of the command line but it still won't do.

Best Answer

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.

Related Question