Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    How to use pipe viewer

    Hi Guys,

    I am trying to use the pv command. I wanted to do something like this

    (cp install/common/pcre* /home/karthik;cd /home/karthik;tar -zxvf pcre-*.tar.gz;rm -rf pcre-*.tar.gz;cd pcre*;./configure)

    How do I use the pv for the above command set and show it in a dialog gauge ?

    Can someone help me out on this.

  2. #2

    I don't think you can use pv that way. If you want to show progress, you could use the GUI zenity program, e.g.:
    myfunc|zenity --progress --pulsate
    however, it does not show command output in the terminal, which I find annoying.

    you could write your own simple activity widget in Bash, e.g.:
    myfunc > /tmp/myfunc.log 2>&1 &
    while ps -p $! >/dev/null 2>&1; do
      printf '*'
      sleep 1

  3. #3
    Thank you.

    Since I am using a minimal installed centos 6.2, zenity does not work for me, Is it possible to use the same kind of notation with dialog ?

  4. $spacer_open
  5. #4
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Saint Paul, MN, USA / CentOS, Debian, Slackware, {Free, Open, Net}BSD, Solaris

    I use pv to show progress of a tar and gzip. Perhaps this snippet will help you fit pv into your scheme:
      tar cvf - -C $directory . 2>>$LOG |
      pv -cN tar -s "$size" |
      gzip |
      pv -cN gzip > ${destination}
    The man page for pv shows it being piped into dialog, but I don't use that. This writes directly to STDOUT, so I can watch it in an ssh session.

    If you want to show the progress of the cp, then pv might not be able to be used, because pv needs to be in the pipeline.

    The script bar at Theiling Online: ASCII bar demonstrates how to use bar in some situations as a replacement for cp, showing the progress.

    Best wishes ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  6. #5
    Quote Originally Posted by skarthikbe2006 View Post
    Is it possible to use the same kind of notation with dialog ?
    Sure, here is a good tutorial on using dialog to do that:

    A progress bar (gauge box) - Linux Shell Scripting Tutorial - A Beginner's handbook

    I've used the bar that drl mentions, as well, very handy.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts