Operations 4 min read

Add a Real‑Time Progress Bar to Linux cp and mv with advcpmv

This tutorial shows how to patch GNU coreutils using the open‑source advcpmv project so that the cp and mv commands display a progress bar, including step‑by‑step compilation, alias configuration, and sample output demonstrating total and per‑file progress.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Add a Real‑Time Progress Bar to Linux cp and mv with advcpmv

This article introduces how to use the open‑source GitHub project advcpmv to add a progress bar to the Linux cp and mv commands.

Because cp and mv belong to the coreutils package, the main task is to apply a patch to coreutils during compilation to enable the progress‑bar feature.

# Avoid using the root user when possible
$ pwd
/home/tinychen

# Download coreutils
$ wget http://ftp.gnu.org/gnu/coreutils/coreutils-8.32.tar.xz
$ tar -xJf coreutils-8.32.tar.xz
$ cd coreutils-8.32/

# Download the patch from GitHub
$ wget https://raw.githubusercontent.com/jarun/advcpmv/master/advcpmv-0.8-8.32.patch
# Apply the patch to add progress‑bar support
$ patch -p1 -i advcpmv-0.8-8.32.patch
patching file src/copy.c
patching file src/copy.h
patching file src/cp.c
patching file src/mv.c

# Compile and install
$ ./configure
$ make
# Copy the patched binaries to /usr/local/bin
$ sudo cp src/cp /usr/local/bin/cp
$ sudo cp src/mv /usr/local/bin/mv

After installation, simply add the -g option when invoking cp or mv to show the progress bar. For convenience, you can create aliases in .bashrc:

$ alias cp='cp -ig'
$ alias mv='mv -ig'

Testing the effect, copying a large directory now displays total progress, per‑file progress, and average speed after completion.

$ cp -r /samba/Elements02/kvm/* /kvm/

0 files copied so far...                                   1.6 GiB /  67.2 GiB
[===>                                                     ]  2.4 %
Copying at 178.4 MiB/s (about 0h 6m 45s remaining)
/samba/Elements02/kvm/iso/CentOS-6.10-x86_64-bin-DVD1.iso   1.6 GiB /   3.7 GiB
[========================================================================>               ] 43.4 %

Link: https://tinychen.com/20201128-add-progess-bar-in-cp-mv/

(Copyright belongs to the original author, remove if infringing)

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxBashprogress barcpcoreutilsadvcpmvmv
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.