Introduction
The dd command-line utility is used to convert and copy files on Unix and Unix-like operating systems. By default, the dd
command doesn’t show any output while transferring files.
This could be problematic when copying large files since you cannot monitor the process.
In this tutorial, you will learn how to use the dd
command to show progress.
Prerequisites
- A system running Linux
- A user account with sudo or root privileges
- Access to a terminal window / command line
- GNU Coreutils version 8.24 or above
Check dd Version
To see the progress bar while copying files and directories with the dd
command, you need a version of dd (coreutils) no older than 8.24. Check the version with the command:
dd --version
At the time of writing, the latest version of dd (coreutils) is 8.30 as seen in the image above.
Note: If you need to install coreutils, run: sudo apt-get install -y coreutils
.
Option 1: Use the dd Command to Show Progress
The basic syntax for using the dd
command is:
dd if=/path/to/input of=/path/to/output
However, the default settings do not show a progress bar or any output while the process is taking place.
To see the progress bar, add the status=progress
attribute to the basic command:
dd if=/path/to/input of=/path/to/output status=progress
While the system is copying the specified file, it shows the amount of data that has been copied and the time elapsed.
Once the process is complete, the terminal displays the total amount of data transferred and the time duration of the process.
Option 2: Use dd Command with pv to Show Progress
The pv
command allows a user to see the progress of data through a pipeline. You can use it with the dd
command to show the progress of a specified task.
To do so, you need to install pv.
On Ubuntu/Debian systems run:
sudo apt install pv
On CentOS/Redhat systems run:
sudo yum install pv
To use pv
with the dd
command follow the syntax:
dd if=/path/to/input | pv | dd of=/path/to/output
Conclusion
After reading this article, you should know how to show progress while running the dd
command, with or without the pv
command.
Download a free copy of Linux Commands Cheat Sheet to help you with managing your instance of Linux.
Next you should also read
How to Change File Permissions Recursively with chmod in Linux
August 17, 2020
Setting file and directory permission properly is important in multi-user systems such as Linux. You can set…
How to Use fsck Command to Check and Repair Filesystem
May 14, 2020
If you want to keep your filesystems clean and without errors, you need to scan it on regular basis. In this…
How to Copy Files and Directories in Linux
May 21, 2019
Want to learn how to copy files in Linux OS? This guide will show you how to use the Linux commands to copy…
Linux SCP Command: Securely Copy & Transfer Files
February 5, 2019
Tutorial on securely transferring files between Unix or Linux systems using the SCP command. The SCP or…
Author
Sofija Simic
Sofija Simic is an aspiring Technical Writer at phoenixNAP. Alongside her educational background in teaching and writing, she has had a lifelong passion for information technology. She is committed to unscrambling confusing IT concepts and streamlining intricate software installations.