How to Show Progress During Tar Compression Ubuntu
This article outlines the methods for monitoring tar command execution on Ubuntu systems. It details the native verbose flag for file listing and recommends external tools for displaying percentage-based progress bars during compression tasks.
The native option to view activity during tar compression is the -v flag, which stands for verbose. When added to your command, it lists every file as it is added to the archive. This confirms the command is running, but it does not show a percentage or estimated time of completion.
To use the verbose option, run the following command:
tar -cvf archive.tar /path/to/directory
For a true progress bar showing percentage and speed, you should pipe the tar command through the pv (Pipe Viewer) utility. This tool is not installed by default but is available in the Ubuntu repositories.
Install pv using the terminal:
sudo apt install pv
Once installed, you can view compression progress by combining tar and pv. Use this command structure to see a dynamic progress bar:
tar -cf - /path/to/directory | pv > archive.tar
This method provides real-time feedback on the data transfer rate and completion percentage, offering a clearer view of progress than the native verbose flag alone.