Add a Real-Time Progress Bar to Linux cp and mv Commands with advcpmv
This guide shows how to compile the GNU coreutils package with the advcpmv patch to enable a progress‑bar for the cp and mv commands, including downloading source, applying the patch, building, installing the patched binaries, and creating convenient aliases for everyday use.
This article explains how to use the open‑source advcpmv project on GitHub to add a progress bar to the Linux cp and mv commands.
Because cp and mv belong to the GNU coreutils package, the solution is to patch and recompile coreutils.
# 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 advcpmv patch from GitHub
$ wget https://raw.githubusercontent.com/jarun/advcpmv/master/advcpmv-0.8-8.32.patch
# Apply the patch
$ 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
# Configure, build and install
$ ./configure
$ make
$ sudo cp src/cp /usr/local/bin/cp
$ sudo cp src/mv /usr/local/bin/mvAfter installing the patched binaries, add convenient aliases to .bashrc so the progress bar appears automatically:
$ alias cp='cp -ig'
$ alias mv='mv -ig'Running a large copy now shows overall progress, per‑file progress, and average speed, e.g.:
$ 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 %Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
