How to use the command 'progress' (with examples)
The progress
command is a useful tool for Unix-like operating systems that allows users to display or monitor the progress of running coreutils commands. It provides a user-friendly interface to visualize the progress of commands like cp
, mv
, dd
, tar
, and others, making it easier to determine how much of a task is complete and how much time remains. The command can be instrumental in improving workflow efficiency, especially for users who regularly handle large file operations.
Use case 1: Show the progress of running coreutils
Code:
progress
Motivation:
Users often engage in file operations such as copying or moving large files or directories. It’s not always clear how much time these operations will take or how much has already been completed. By using progress
, users can get real-time updates on their command line, providing them with the ability to manage their time better and plan their next steps accordingly.
Explanation:
The command progress
without any arguments scans the currently running processes of coreutils commands and displays the progress information. It provides users with a direct and immediate insight into the file operations without requiring additional configuration or inputs.
Example output:
Procs [running / total ]: 2 / 4
Progress: [###....] 47% -- ETA 5m
Use case 2: Show the progress of running coreutils in quiet mode
Code:
progress -q
Motivation:
While sometimes it is desirable to have detailed progress information, there might be cases where minimal verbosity is preferred. Quiet mode is particularly beneficial in scripts or when users need a less-distracting display, allowing for cleaner output without unnecessary text.
Explanation:
The -q
flag stands for “quiet mode.” In this mode, progress
reduces the amount of output to the bare minimum required to understand the status of the operations. This flag is useful when verbosity is seen as an impediment rather than a help.
Example output:
47%
Use case 3: Launch and monitor a single long-running command
Code:
command & progress --monitor --pid $!
Motivation:
Long-running commands can be particularly nerve-wracking when you are unsure of their completion status. Monitoring a specific command ensures you can keep tabs on its progress and estimated time to completion. It enhances productivity by helping users decide how to allocate their resources while waiting for the process to finish.
Explanation:
command &
runs the command in the background, allowing users to continue with other tasks in the terminal.progress --monitor
tells theprogress
tool to actively monitor the command.--pid $!
uses the process ID of the last background command (given by$!
), allowingprogress
to track it directly.
Example output:
Monitoring PID 2345: [#####.....] 56% -- ETA 12m
Use case 4: Include an estimate of time remaining for completion
Code:
progress --wait --command firefox
Motivation:
Knowing how much longer a command will take is incredibly useful for time management. This option provides an estimate of the time remaining for the completion of a command, allowing users to prioritize their tasks better. Whether you’re waiting for an application to complete installation or a download to finish, this feature is invaluable.
Explanation:
--wait
indicates thatprogress
should start only after the provided command begins execution if it is not already running.--command firefox
specifies that the command to be monitored isfirefox
. This setup is beneficial when tracking commands that might be initiated by other scripts or applications.
Example output:
Progress for 'firefox': [######....] 60% -- ETA 6m
Conclusion
The progress
command is an essential tool for any Unix-like system user who needs to manage and monitor file operations efficiently. By providing clear, understandable updates on the status of running commands, progress
helps users make better-informed decisions about their time and workflow, while the specific use cases demonstrate its versatility in both interactive and scripted environments.