How to use the command 'progress' (with examples)

How to use the command 'progress' (with examples)

The ‘progress’ command is a tool used to display and monitor the progress of running coreutils. It provides valuable information about the status of ongoing processes and allows users to track their completion.

Use case 1: Show the progress of running coreutils

Code:

progress

Motivation: This use case is helpful when you want to monitor the progress of the coreutils running on your system. By running the command without any arguments, you can obtain a real-time update on the status of coreutils processes.

Explanation: The ‘progress’ command without any arguments simply displays the progress of running coreutils. It continuously refreshes the output to show the current status of the processes.

Example output:

[1456] (coreutils) cat /path/to/file.txt - 85% complete (1.2s elapsed, 0.5s remaining)

Use case 2: Show the progress of running coreutils in quiet mode

Code:

progress -q

Motivation: This use case is suitable when you want to view the progress of running coreutils but with minimal output. By using the ‘-q’ flag, the command will run in quiet mode, providing a less verbose display.

Explanation: The ‘-q’ flag, when appended to the ‘progress’ command, enables quiet mode. In quiet mode, the command only outputs essential details, reducing the amount of information displayed.

Example output:

[1456] (coreutils) cp file1.txt file2.txt - 35% complete

Use case 3: Launch and monitor a single long-running command

Code:

command & progress --monitor --pid $!

Motivation: This use case proves useful when you have a long-running command that you want to launch and monitor simultaneously. By using this approach, you can keep track of the progress of the command without obstructing your terminal.

Explanation: In this use case, the long-running command is launched in the background using an ampersand (’&’) at the end. The ‘progress’ command, along with the ‘–monitor’ and ‘–pid’ options, is then used to monitor the progress of the command by specifying the process ID (’$!’) of the last background process.

Example output:

[1456] (custom-command) Long-running command - 45% complete

Use case 4: Include an estimate of time remaining for completion

Code:

progress --wait --command firefox

Motivation: When executing a command, it can be helpful to have an estimated time remaining for completion. This use case allows you to monitor the progress of the specified command and get a rough estimate of how much time is left.

Explanation: The ‘–wait’ flag instructs the ‘progress’ command to wait for the completion of the provided ‘–command’ argument. In this case, the specified command is ‘firefox’. The output of the command includes an estimate of the time remaining until the command completes.

Example output:

[1456] (firefox) Loading webpage example.com - 60% complete (2s elapsed, 3s remaining)

Conclusion:

The ‘progress’ command is a versatile tool for monitoring the progress of running coreutils and other long-running commands. By using the various options and arguments, you can customize the output and obtain valuable information about ongoing processes. This allows for better visibility and control over the execution of commands on the system.

Related Posts

How to use the command 'cs fetch' (with examples)

How to use the command 'cs fetch' (with examples)

The ‘cs fetch’ command is used to fetch the JARs of one or more dependencies.

Read More
How to use the command 'mtr' (with examples)

How to use the command 'mtr' (with examples)

The ‘mtr’ command is a combined traceroute and ping tool developed by Matt Kimball.

Read More
How to use the command "command" (with examples)

How to use the command "command" (with examples)

The command command is used to force the shell to execute a specified program, while ignoring any functions, builtins, or aliases that have the same name.

Read More