How to Install and Use xcp in Linux for Fast Parallel File Copying with Progress Bars

The standard GNU cp command has served as the default file-copying utility on Linux for decades. However, when duplicating multi-gigabyte virtual machine images, extensive dataset directories, or deep source code repositories, cp exhibits notable limitations: it operates strictly single-threaded, offers no native progress indicators, provides no estimated time of arrival (ETA), and fails to exploit modern Copy-on-Write (CoW) filesystem capabilities by default. xcp is a modern, high-performance replacement for cp written in Rust. Designed for contemporary NVMe solid-state storage and multi-core processors, xcp delivers multi-threaded parallel copying, visual throughput progress bars, and automatic reflink acceleration.

Key Advantages of xcp Over Standard cp

Upgrading your terminal workflow to xcp provides several immediate advantages:

  • Multi-Threaded Parallelism: While standard cp crawls sequentially through directories one file at a time, xcp concurrently traverses file trees and copies data streams across multiple worker threads.
  • Visual Progress Indicators: Displays a dynamic, real-time terminal progress bar showing transfer percentages, current throughput speeds (MB/s or GB/s), and estimated completion times.
  • Automatic Reflink (CoW) Support: On modern Copy-on-Write filesystems such as Btrfs, XFS, and ZFS, xcp automatically creates instantaneous metadata reflinks, duplicating large files in milliseconds without consuming additional disk space.
  • Graceful Error Handling: Rather than abruptly halting entire recursive operations upon encountering a single unreadable or permission-restricted file, xcp reports the failure cleanly and continues copying remaining items.
  • Granular Filtering: Supports file globbing and regex exclusions directly from the command line without requiring complex find or rsync pipelines.

How to Install xcp in Linux

Xcp is packaged across multiple Linux distributions and can also be installed using pre-compiled binaries or Cargo.

Method 1: Install via Native Package Managers

On Arch Linux and Manjaro, install xcp directly from the official extra repository:

sudo pacman -S xcp

On Debian, Ubuntu, and Linux Mint, xcp is available in newer release repositories or can be installed via pre-built .deb packages from GitHub releases:

wget https://github.com/tarka/xcp/releases/latest/download/xcp-x86_64-unknown-linux-musl.tar.gz
tar -xzf xcp-x86_64-unknown-linux-musl.tar.gz
sudo mv xcp /usr/local/bin/
xcp --version

On Fedora and CentOS Stream:

sudo dnf install xcp

Method 2: Install via Cargo (Rust Toolchain)

If you maintain a local Rust development environment, compile and install xcp globally:

cargo install xcp

How to Use xcp for Everyday File Operations

Xcp adopts syntax intuitive to anyone familiar with standard copy commands: xcp [options] <source> <destination>.

1. Copying Individual Files with Real-Time Progress

To copy a large ISO file or database archive to a backup drive:

xcp ubuntu-24.04-desktop-amd64.iso /mnt/backup/

During the operation, xcp renders a formatted progress bar in your terminal, detailing bytes copied, data transfer velocity, and an accurate countdown timer.

2. Recursive Directory Copying

To duplicate entire directory hierarchies, pass the -r (or --recursive) flag:

xcp -r /var/www/html /backup/html_backup

Xcp spawns worker threads matching your available CPU cores, saturating storage bus bandwidth to complete directory duplication significantly faster than GNU cp -r.

3. Using Copy-on-Write Reflinks on Btrfs and XFS

When working on Btrfs or reflink-enabled XFS volumes, xcp automatically employs CoW cloning. To explicitly mandate reflink cloning or fail if unsupported:

xcp --reflink=always virtual_disk.qcow2 virtual_disk_snapshot.qcow2

This duplicates a 100 GB disk image virtually instantaneously without writing physical data blocks to the drive.

4. Excluding Specific Files and Directories

To exclude build artefacts, version control databases, or cache directories during a recursive transfer:

xcp -r --glob "!node_modules/*" --glob "!.git/*" project/ /mnt/share/project/

Creating a Shell Alias for Seamless Replacement

Once you are comfortable with xcp, configure your shell to use it as your default copying command.

  1. Open your shell profile (e.g., ~/.bashrc or ~/.zshrc) in a text editor:
    nano ~/.bashrc
  2. Add the following alias:
    alias cp='xcp'
  3. Save the file and reload your configuration:
    source ~/.bashrc

Whenever you need to invoke the original GNU utility, bypass the alias by prefixing the command with a backslash: \cp source destination.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.