Прогрессбар в линуксе / progress bar linux / progress linux debian centos ubuntu

1. Using pv command

Pv could be a good replacement for cp and installation is quite easy in Ubuntu but you should know if you use this command all file permissions and ownerships would be gone so be careful on use it. In order to install it just type following command,

1
$ sudo apt-get install pv

2. Using cp with some Bash script

In this solution you need to use the following Bash script and you should copy this file over to /bin/ folder in order to be accessed globally and easy like cp command. The script source code is in the following section,

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
# SCRIPT:  copyx ver 1.0, 14-9-2011
# PURPOSE: Copies files and shows the progress of copying.
# Usage Example: ./copyx my100gbfiles.tar.gz /path/to/destination/my100gbfiles.tar.gz
strace -q -ewrite cp -- "${1}" "${2}" 2>&1 \
| awk '{
cal += $NF
if (cal % 10 == 0) {
percentage = cal / totalsize * 100
printf "%3d%% [", percentage
for (i=0;i<=percentage;i++)
printf "="
printf ">"
for (i=percentage;i<100;i++)
printf " "
printf "]\r"
}
}
END { print "" }' totalsize=$(stat -c '%s' "${1}") cal=0

3. Using rsync command

Rsync command is another replacement for cp command which equipped with progress bar and speed indicator which personally I highly recommend  it.

1
$ rsync -avh --progress [Source] [Dest]

4. Using gcp command

Gcp is also another command that can be used instead of cp. You can install gcp in Ubuntu with the following command,

1
$ sudo apt-get install gcp
Прогрессбар в линуксе / progress bar linux / progress linux debian centos ubuntu