Article

Command line tapas: Use Pipe Viewer to count new lines per second

Often I have to have a look at log files to see how a system behaves. For example, recently I wanted to find out how many points of interest per second were imported.

I used to just count manually. But that didn't really scale well.

So this is what I use now:

tail -f poi_log | pv -lr >/dev/null

This command uses Pipe Viewer to find out how many lines are running through the pipe every second.

What I really like about this is that you can drill down even further if you use tools like grep. For example, it's trivial to find out how active Bing is on your site.

tail -f access.log | grep "bingbot" | pv -lr -i 10 >/dev/null
=> [3.97/s ]

Before you give it a shot, you have to install Pipe Viewer.

Use apt-get install pv on Ubuntu/Debian or brew install pv on a Mac.

I hope you like pv as much as I do. It's very simple & focused and perfect in everyone's toolbox.

  • command-line
  • linux

Replies

To reply from the fediverse, follow @robert@rocu.de or look up the address of this post from your account.