I'm trying to use pv, but I want to hide the command I piped in's output while still be able to see pv's output. Using command &> /dev/null | pv doesn't work (as in, pv doesn't receive any data). command produces output on both standard output and standard error, and I don't want to see either.

I tried using a grep pipe (command &> /dev/null | pv | grep <=>) but that now and then outputs things to the terminal.

  • Although it didn't do as i expected, it still didn't hide the original command's output. 'command | pv' I want to hide 'command' 's output and still see 'pv''s output. – Lee Ikard Jun 29 '17 at 0:04

man pv says:

To use it, insert it in a pipeline between two processes, with the appropriate options. Its standard input will be passed through to its standard output and progress will be shown on standard error.

The output you see comes from pv. The progress bar is on stderr, and the content you piped in is on stdout. You can redirect the output:

cmd | pv > /dev/null

and you will still get the progress bar output.

If the command produces its own text on stderr as well, you can redirect that explicitly to /dev/null, before passing on the output to pv:

cmd 2>/dev/null | pv > /dev/null
  • I'll try out them all and return what works for me. – Lee Ikard Jun 29 '17 at 0:13
  • 'cmd 2> /dev/null | pv > /dev/null' works for me. Thanks. – Lee Ikard Jun 29 '17 at 0:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.