Show Progress of dd Command
The versatile dd command is often used for creating bootable USBs.
The problem here is that when the dd command is used for writing the contents of the huge ISO file to the USB disk, it takes time and it may seem like the command is hanged.
This problem can be overcome by displaying the progress of the running dd command.
You can show the file transfer progress by providing the status=progress
flag to the dd command. Here's a pseudo command example of what it would look like:
sudo dd if=input_file_path of=output_file_path bs=4M status=progress
Let's see it in action with a practical example.
Example of showing dd command progress
By default, dd command doesn't show any transfer progress and it may confuse some people.
Let me share an example where I am making a live USB of Ubuntu Studio.
sudo dd if=ubuntustudio-23.10-dvd-amd64.iso of=/dev/sdb1 bs=4M
The input ISO file is around 5 GB in size and when I ran the dd command to create the live USB, it took approximately 20 minutes.
Now imagine that the dd command is running but you see the terminal in the below state for 20 minutes.
Not a pretty sight because it may seem like the command is hanged. You have no idea how much data is transferred. Only when the command finishes, you can see the stats.
Next, I ran the same command but this time, I added the status=progress
flag to it.
sudo dd if=ubuntustudio-23.10-dvd-amd64.iso of=/dev/sdb1 bs=4M status=progress
Now, the dd command shows the file transfer status.
So it seems like something is happening and the screen is not blank like earlier. This is a much better user experience, in my opinion.
More on file transfer progress
That's why I recommend using the status=progress
flag with the dd command always.
In fact, I recommend the same with rysnc command so that you can see the status of file transfer
Not only that, you can even show the file copying status with the cp command.