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.
Đăng ký liền tay Nhận Ngay Bài Mới
Subscribe ngay
Cám ơn bạn đã đăng ký !
Lỗi đăng ký !
Add Comment