This post will guide you how to show progress while using dd command in Linux. How do I monitor the progress of dd command. when you want to copy the content of a hardware disk to another or a big file to another file using dd command, there is nothing to tell you of its progresses. It just sits there at the cursor until the comand finally finishes. This tutorial explains two methods to show progress bar for dd command or linux command.
- Linux dd Command
- Linux pv Command
- Show Progress of dd Command
- Show Progress of dd or other Linux Command Using Pv
Linux dd Command
dd command can be used to copy a file, converting and formatting according to the operands on Linux.
Linux pv Command
pv command can be used to monitor the progress of data through a pipe. pv allows a user to see the progress of data through a pipeline, by giving information such as time elapsed, percentage completed (with progress bar), current throughput rate, total data transferred, and ETA.
Show Progress of dd Command
If you want to show progress using dd command
, and you need to use gnu dd command from coreutils version 8.24 or above, and then pass the status=progress
option to dd command so that to dispaly the progress on your Linux system. the below is a example for dd command to show progress:
dd if=/dev/unrandom of=/dev/null status=progress
Outputs:
[root@localhost ~]# dd if=/dev/urandom of=/dev/null status=progress
1550493696 bytes (1.6 GB) copied, 13.000031 s, 119 MB/s
To check the version of coreutils on your Linux system, and you just need to issue the following command:
$ dd --version
outputs:
[root@localhost ~]# dd --version
dd (coreutils) 8.24
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Paul Rubin, David MacKenzie, and Stuart Kemp.
If you are not able to install the latest version of coreutils package through your default repository of Linux system, and you can install it by compling source package of coreutils with the following command:
wget ftp://ftp.gnu.org/pub/gnu/coreutils/coreutils-8.24.tar.xz tar -xf coreutils-8.24.tar.xz cd coreutils-8.24 ./configure && make -j $(nproc)
Show Progress of dd or other Linux Command Using Pv
You can also use another tool named pv
to monitor the progress of dd
command and check its status. before using it, and you need to install it by using the following command, type:
For Ubuntu or Debian Linux:
$ sudo apt install pv
For CentOS or Redhat Linux:
$ sudo yum install pv
outputs:
[root@localhost ~]# yum install pv Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * centos-sclo-rh: mirrors.aliyun.com * centos-sclo-sclo: mirrors.ustc.edu.cn * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package pv.x86_64 0:1.4.6-1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: pv x86_64 1.4.6-1.el7 epel 47 k Transaction Summary ================================================================================ Install 1 Package Total download size: 47 k Installed size: 93 k Is this ok [y/d/N]: y Downloading packages: pv-1.4.6-1.el7.x86_64.rpm | 47 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : pv-1.4.6-1.el7.x86_64 1/1 Verifying : pv-1.4.6-1.el7.x86_64 1/1 Installed: pv.x86_64 0:1.4.6-1.el7 Complete!
To show progress bar using pv command for dd command, and you need to put pv command between input and output only dd commands. Let’s see the below dd command example:
$ dd if=/dev/urandom | pv | dd of=/dev/null
Outputs:
[root@localhost ~]# dd if=/dev/urandom | pv | dd of=/dev/null 244MiB 0:00:03 [82.1MiB/s] [ <=> ] Conclusion
You should know that how to use pv command to display progress bar while using dd command or other Linux commands on your Ubuntu or Debian Linux. If you want to see more detailed information about pv or dd command, you can use the following commands:
$ man pv $ man dd