How to prevent ps from truncating the process name
Solution 1:
The simplest thing you can do is swap the order of outputs: if cmd
is last, it will be extended to the full width of the terminal:
ps -eo pid,etime,cmd
If that's still not sufficient, you can add a -w
(wide) output modifier
ps -ewo pid,etime,cmd
An additional w
gives even wider output
ps -ewwo pid,etime,cmd
(In both of these cases, the output may be wrapped by the terminal.) If you really must have the original field order, then you can specify an explicit width for the cmd field using the syntax field:width
e.g.
ps -eo pid,cmd:80,etime
This can be combined with the -w
flag(s) if necessary e.g.
ps -ewo pid,cmd:160,etime
The width of a particular output column can also be forced wider by using a longer header string e.g.
ps -eo pid,cmd=my_very_very_very_long_command_that_I_want_to_see_more_of,etime
Solution 2:
ps -A -o pid,user:20,%cpu,%mem,comm,args