Archive for the 'cli' Category


Tunnel to the World 0

A lot of people know that OpenSSH’s client supports tunneling out of the box. But some don’t realize that it also supports tunneled SOCKS out of the box. Here’s how to set up a quick SOCKS proxy across an encrypted tunnel:

ssh -NfD 8888 user@host

The proxy will be on port 8888. The other flags just tell ssh to go immediately to the background (after getting your password, if needed) without running a command.

Check out your Pipes 2

While we’re on the topic of the Linux command line, I figured I’d highlight a useful tool that I accidentally discovered a few days ago. I don’t remember what I was searching portage for, but I happened across Pipe Viewer, or pv. From the website:

Pipe Viewer – is a terminal-based tool for monitoring the progress of data through a pipeline. It can be inserted into any normal pipeline between two processes to give a visual indication of how quickly data is passing through, how long it has taken, how near to completion it is, and an estimate of how long it will be until completion.

And using it? You just insert pv anywhere you’re piping data between processes — it simply passes the data from stdin to stdout — and you get a nice little wget style progress bar. For instance, I could insert it in Matt’s previous example, and I’d get something like:

# pv /var/log/messages | grep bumttwagnerfor 
>  | awk '{ print $10}' | sed "s/[/ /g" 
>  | sed "s/]/ /g" | awk '{print $2}'
94.5MB 0:00:03 [34.3MB/s] [=======>            ] 41% ETA 0:00:04

The only thing I’ve noticed is that you really need to be working with a lot of data to make the information it provides useful; most of the time the piping is completed by the time you even get any output. But for situations where you’re dealing with a lot of data (like log files), it’s golden!