I built a SaaS app called Domain Clamp which monitors domain and SSL certificates and sends you notifications before anything expires. If you've ever been blamed (e.g. by a client) for letting a domain you don't own expire, check it out »
I don't know about you, but I'm not a fan of typing a command into the terminal and then nothing happening. Generally, any command that I know might take a while I'll run in verbose mode. That's great, I know that the process really is running. But what I don't know how far along it is...and how much more there is to go.
Today I found out about the
pv command. Boy, is that a game changer...
I stumbled upon
pv (short for Pipe Viewer) as I was wondering if there was anyway to know the status of MySQL import. Basically, you start out by running your input file through
pv and then piping that out to whatever command you were originally intending to run.
pv then keeps track of and reports on the status of wherever it's output is going.
pv shows the the amount of data transfered, the amount of time running, the transfer rate, a progress bar, the percentage complete, and an eta. I find the defaults to work perfectly, but if you'd like to tinker with things details on all the switches can be found here.
Head to the projects home page here for installation instructions. I was running
pv on a CentOS system and used the
yum package manager for installation.
While we're on the subject, it should be said that tmux is also a great tool for these types of long running jobs. If you don't know about it there's a great primer here.
While a MySQL import seems like one of the most common use cases for
pv, I anticipate I'll get additional mileage out of
pv down the road. For example, I can see myself using it one day when running a long
uniq command on a massive Apache log file.
How are you using
pv? I'd love to hear some more use cases in the comments.