4 ms·
ps has a nasty habit of truncating its output. Piping it into cat is a way around this. E.G. $ echo $COLUMNS 118 $ ps -fp 14706 UID PID PPID
by sciurus 15y ago
ps has a nasty habit of truncating its output. Piping it into cat is a way around this. E.G.
$ echo $COLUMNS
118
$ ps -fp 14706
UID PID PPID C STIME TTY TIME CMD
root 14706 14705 0 Jan29 pts/3 00:00:00 sudo -p [local sudo] Password: python /usr/lib/sshuttle/main.py pytho
$ ps -fp 14706 | cat
UID PID PPID C STIME TTY TIME CMD
root 14706 14705 0 Jan29 pts/3 00:00:00 sudo -p [local sudo] Password: python /usr/lib/sshuttle/main.py python -v --firewall 12300 0
- robertduncan 15y agoUsing the -ww flag will produce unlimited width output
- sciurus 15y agoThanks! I'd searched the ps manpage for truncate and length. I don't know why I didn't think to look for width.
- emillon 15y agoMost generally, it will trick any command into thinking that it's not writing to a tty ; so piping into cat will often remove colors.
- burgerbrain 15y agoOf course if you want colours, you can often force programs to use them anyway. For example, I use the alias: alias new='ls -lthr --color=always | tail' Normally ls will not use colours when writing to a pipe (not a tty).
- bootload 15y ago"... Piping it into cat is a way around this. ..." I've always preferred less - lets you scroll backwards & forwards through the piped output.