Search
Randomness (via klauster.com)

Entries in tricks (1)

Thursday
Feb092012

OS X command line tricks for SSH and serial console connections

One of the things I love about Mac OS X is having the UNIX-like command line available via Terminal. I tend to just use Terminal for ssh and console access to routers and switches and the like. I do however like to have my output automatically logged to a text file, so I created TextExpander snippets to pipe output to the "tee" command with automatically set a date-stampted filename.

For SSH the looks like:

 ssh user@11.22.33.44 | tee /Users/klaus/ssh_logs/%Y-%m-%d-%H%M%S-ssh.txt

For console via USB to serial this becomes:

 screen /dev/tty.KeySerial1 | tee /Users/klaus/ssh_logs/%Y-%m-%d-%H%M%S-console.txt

Works pretty well so far