News for hackers. Stuff that matters.
Re:Useful use of cat(1) by sciurus on Sunday February 26, 2012 @11:43AM (#3635978)
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
Re:Useful use of cat(1) by emillon on Sunday February 26, 2012 @01:50PM (#3636351)
Most generally, it will trick any command into thinking that it's not writing to a tty ; so piping into cat will often remove colors.
Re:Useful use of cat(1) by burgerbrain on Sunday February 26, 2012 @02:47PM (#3636548)
Of 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).
Re:Useful use of cat(1) by robertduncan on Sunday February 26, 2012 @12:32PM (#3636095)
Using the -ww flag will produce unlimited width output
Re:Useful use of cat(1) by sciurus on Sunday February 26, 2012 @09:33PM (#3637561)
Thanks! I'd searched the ps manpage for truncate and length. I don't know why I didn't think to look for width.
Re:Useful use of cat(1) by bootload on Sunday February 26, 2012 @03:54PM (#3636748)
"... Piping it into cat is a way around this. ..."

I've always preferred less - lets you scroll backwards & forwards through the piped output.