Bash Progress Loading Animation

Creating Progress and Loading Animations in Bash

A memo on how to implement animations that can be used for progress and loading screens in Bash on the Linux command line. How should we express moving text strings like 'now loading...' in Bash? Here's how.

Shou Arisaka
1 min read
Nov 11, 2025

A memo on how to implement animations that can be used for progress and loading screens in Bash on the Linux command line.

How should we express moving text strings like “now loading…” in Bash?

Here’s how.

chars="/\\"

while :; do
  for (( i=0; i<${#chars}; i++ )); do
    echo -en "running... ${chars:$i:1}" "\r"
    sleep 1
        # Do something you like
    . "/mnt/c/pg/detect_changes/detect_changes_in_a_directory_contacam.sh"
  done
done

running… / and running…
alternates every second, showing that it’s working properly, and since the command line uses only one line while running, it’s easy to read even if other messages come in between.

Also, there’s this approach:


echo -ne '#####                     (33%)\r'
sleep 1
echo -ne '#############             (66%)\r'
sleep 1
echo -ne '#######################   (100%)\r'
echo -ne '\n'

Unlike the aforementioned approach that continuously displays animation while running a while loop, this can be used when the progress degree is determined from 1 to 100.

So rather than using it inside a loop, it’s more like using it between parts of a script.

Share this article

Shou Arisaka Nov 11, 2025

🔗 Copy Links