Fundamentals 4 min read

Add a Progress Bar to Linux cp and mv Commands with advcpmv Patch

Learn how to enhance the Linux coreutils cp and mv commands with a visual progress bar by downloading the advcpmv patch, applying it to coreutils source, compiling, installing, and creating convenient aliases, complete with example usage and performance output.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Add a Progress Bar to Linux cp and mv Commands with advcpmv Patch

This guide explains how to add a progress‑bar display to the Linux cp and mv commands, which are part of the GNU coreutils package, by using the open‑source advcpmv patch.

First, obtain the coreutils source code, then fetch and apply the advcpmv patch, compile the modified utilities, and replace the original binaries.

# avoid using root when possible
pwd
/home/tinychen

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

# download advcpmv patch from GitHub
wget https://raw.githubusercontent.com/jarun/advcpmv/master/advcpmv-0.8-8.32.patch
# apply the patch to enable progress bars
patch -p1 -i advcpmv-0.8-8.32.patch

# compile and install the patched utilities
./configure
make
sudo cp src/cp /usr/local/bin/cp
sudo cp src/mv /usr/local/bin/mv

To make the progress bar appear automatically, add aliases to .bashrc (or the appropriate shell startup file):

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

After reloading the shell configuration, any cp or mv operation will show a progress bar. For example, copying a large directory produces output similar to the following, displaying total bytes copied, percentage completed, current speed, and per‑file progress:

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 %
Progress bar example
Progress bar example
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.

Linuxcpcoreutilsadvcpmvmv
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

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.