Skip to content

guileh/shell_progress_bar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pbar: A Shell Script Progress Bar Wrapper

pbar is a simple shell script that wraps common command-line utilities (rsync, dd, cp, mv, curl, wget) to provide a visual progress bar using the pv (Pipe Viewer) command. It allows you to monitor the progress of long-running operations that typically don't show progress by default.

Features:

  • Adds a progress bar to several common commands.
  • Supports customizable bar styles.
  • Lightweight and easy to use.

Prerequisites:

  • pv (Pipe Viewer) command must be installed on your system. You can usually install it via your system's package manager (e.g., sudo apt-get install pv on Debian/Ubuntu, brew install pv on macOS).

Installation:

Quick Installation (Recommended):

You can quickly install pbar by running the following command:

curl -sSL https://raw.githubusercontent.com/guileh/shell_progress_bar/main/install.sh | bash

This command downloads the install.sh script and executes it, which will place pbar in /usr/local/bin/ and make it executable.

Manual Installation:

  1. Clone the repository:
    git clone https://github.com/guileh/shell_progress_bar.git
    cd shell_progress_bar
  2. Make the script executable:
    chmod +x pbar
  3. Add pbar to your PATH (optional): To use pbar from any directory, move it to a directory included in your system's PATH, e.g.:
    sudo mv pbar /usr/local/bin/

Usage:

pbar works by taking a command as its first argument, followed by the arguments for that command.

pbar <command> [command_arguments...]

Supported Commands:

  • rsync: Displays progress for rsync operations.
    pbar rsync -a source/ destination/
  • dd: Displays progress for dd operations.
    pbar dd if=/dev/zero of=output.img bs=1M count=100
  • cp: Displays progress for cp operations.
    pbar cp large_file.zip /tmp/backup/
  • mv: Displays progress for mv operations.
    pbar mv old_file.txt new_location/
  • curl: Displays progress for curl downloads.
    pbar curl -O https://example.com/large_file.tar.gz
  • wget: Displays progress for wget downloads.
    pbar wget https://example.com/another_large_file.zip

Customizing the Progress Bar Style:

You can customize the appearance of the progress bar by setting the BAR_STYLE environment variable. If not set, it defaults to shaded.

Available BAR_STYLE options:

  • plain (default pv style)
  • block
  • granular
  • shaded

Example: To use the block style:

BAR_STYLE=block pbar cp large_file.zip /tmp/backup/

About

Extremely simple progress bar in shell script

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages