enter image description hereCan I see a progress bar or something not only ust the terminal screen output while backing up?

Here is my shell script that I used backup with tar command:

# !/bin/bash

 DATEJOUR=$(date +"%Y-%m-%d-%H-%M-%S")
 REPABACKUPER="--exclude=/home/(username)/myfolders \
 --exclude=/home/(username)/backup                  \
 --exclude=/proc                                    \
 --exclude=/lost+found                              \
 --exclude=/mnt                                     \
 --exclude=/media                                   \
 --exclude=/sys /"

 sudo tar cvpjf $NOMFIC $REPABACKUPER

 exit $?
  • Here is a shell function that combines tar and pv. – Marco Jan 27 '14 at 10:11
  • Thanks all of you.Here is my update and it works. sudo tar -cvpj -f $NOMFIC $REPABACKUPER | pv -cN Backup_Now | tar -xvf - – John Jan 29 '14 at 7:44

pipebench shows running time, data processed and speed:

tar -cj --exclude=filename source_dir | pipebench >dest.tar.bz2

That's what I use for backup, the progress bar is powered by pv command

tar cf - . --exclude=backup --exclude=$file | pv -s `du -sb . | grep -o '[0-9]\+'` -N tar  | gzip > $file

du -sb . | grep -o '[0-9]\+' this part is responsible for getting 100% in your progress bar

  • 1
    Your tar is using compression, so du isn't going to tell how much data it has to write. (take the z off and pipe to gzip) – Ricky Jan 27 '14 at 8:37

Not possible. tar doesn't know how much data it has to work with until it's done with it. Unlike rsync, it does not scan the source tree before processing.

(During extraction, it's possible, but I don't know any versions of tar that bothers.)


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