views:

464

answers:

4

Hi,

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

Thank you

-- Update --

I am sorry for downgrading,I thought others won't find the answer useful too, so I downgraded.

Here is the info you asked for.

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 = ; eol2 = ; swtch = ; 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

A: 

you can set output format,eg to see only the command and the process id.

ps -eo pid,args

see the man page of ps for more output format. alternatively, you can use the -w or --width n options.

If all else fails, here's another workaround, (just to see your long cmds)

awk '{ split(FILENAME,f,"/") ; printf "%s: %s\n", f[3],$0 }' /proc/[0-9]*/cmdline
ghostdog74
This didn't work for me.
Algorist
change the order and try again, pid,args
ghostdog74
+1  A: 

Passing it a few ws will ignore the display width.

Ignacio Vazquez-Abrams
Tried this, but still some part of the command is not shown.
Algorist
Did you try adding more than one?
Ignacio Vazquez-Abrams
I tried adding more than 5..but somehow it doesn't show the complete command.
Algorist
Once you get to 3 you're seeing all that there is. Nothing beyond what it shows there is visible to *any* program. You have a different problem.
Ignacio Vazquez-Abrams
A: 

If none of the solutions above work, the output of ps isn't your problem. Maybe you need to set putty to wrap long lines?

Otherwise, we need more information.

Alok
This occurs in gnome-terminal and native linux tty's also(ctrl+alt+f1 to f7) ..
Algorist
Oh well. There is something weird going on.
Alok
+1  A: 

It is likely that you're using a pager such as less or most since the output of ps aux is longer than a screenful. If so, the following options will cause (or force) long lines to wrap instead of being truncated.

ps aux | less -+S

ps aux | most -w

If you use either of the following commands, lines won't be wrapped but you can use your arrow keys or other movement keys to scroll left and right.

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)

Lines are always wrapped for more and pg.

When ps aux is used in a pipe, the w option is unnecessary since ps only uses screen width when output is to the terminal.

Dennis Williamson