Coder Perfect

Viewing the entire output of the PS command

Problem

Few processes are too long to fit in my current window width when I run ps -aux on my linux server, to which I connected using putty. Is there another option?

— Update —

I apologize for degrading; I assumed that others would not find the answer valuable as well, therefore I did so.

Here is the information you requested.

hadoop-user@hadoop-desk:~$ echo $TERM
xterm

hadoop-user@hadoop-desk:~$ stty -a
speed 38400 baud; rows 47; columns 158; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

hadoop-user@hadoop-desk:~$ echo $COLUMNS
158

Asked by Boolean

Solution #1

You can view the complete path to output in your terminal window and from shell scripts if you use the auxww flags.

darragh@darraghserver ~ $uname -a
SunOS darraghserver 5.10 Generic_142901-13 i86pc i386 i86pc

darragh@darraghserver ~ $which ps
/usr/bin/ps<br>

darragh@darraghserver ~ $/usr/ucb/ps auxww | grep ps
darragh 13680  0.0  0.0 3872 3152 pts/1    O 14:39:32  0:00 /usr/ucb/ps -auxww
darragh 13681  0.0  0.0 1420  852 pts/1    S 14:39:32  0:00 grep ps

ps aux displays a list of all processes run by all users. For further information, see man ps. The ww flag specifies an unrestricted width.

-w         Wide output. Use this option twice for unlimited width.
w          Wide output. Use this option twice for unlimited width.

The solution can be found in http://www.snowfrog.net/2010/06/10/solaris-ps-output-truncated-at-80-columns/.

Answered by darraghmurphy

Solution #2

Because the output of ps aux is longer than a screenful, you’re probably using a pager like less or most. If this is the case, the choices below will induce (or force) large lines to wrap rather than be truncated.

ps aux | less -+S

ps aux | most -w

Lines will not be wrapped if you use either of the following commands, but you can scroll left and right using your arrow keys or other movement keys.

ps aux | less -S    # use arrow keys, or Esc-( and Esc-), or Alt-( and Alt-) 

ps aux | most       # use arrow keys, or < and > (Tab can also be used to scroll right)

For more and more, lines are always wrapped.

The w parameter is not required when using ps aux in a pipe because ps only utilizes screen width when output is to the terminal.

Answered by Dennis Williamson

Solution #3

simple and perfect:

ps -efww

won’t truncate line

Answered by theDolphin

Solution #4

Simply toss it on the cat, who will automatically line-wrap it.

ps aux | cat

Answered by yoki

Solution #5

By passing it a few ws, the display width will be ignored.

Answered by Ignacio Vazquez-Abrams

Post is based on https://stackoverflow.com/questions/2159860/viewing-full-output-of-ps-command