To integrate this progress bar feature directly into the system's core commands (cp, mv), you can create wrapper scripts around the existing commands and place them in a directory that is prioritized in the system's PATH. Here's how you can do it:
Create scripts that wrap around the existing cp, mv commands and add the progress bar functionality.
#!/bin/bash
# cp wrapper with progress
rsync -ah --info=progress2 "$@"#!/bin/bash
# mv wrapper with progress
rsync -ah --info=progress2 --remove-source-files "$@"-
Create a Directory for the Wrappers:
Create a directory where you will place these wrapper scripts:
mkdir -p ~/.local/bin -
Save the Wrapper Scripts:
Save the above scripts as
cp,mvin~/.local/bin/.Example:
nano ~/.local/bin/cp(Paste the
cpwrapper script and save it)nano ~/.local/bin/mv(Paste the
mvwrapper script and save it) -
Make the Scripts Executable:
Make sure the scripts are executable:
chmod +x ~/.local/bin/cp chmod +x ~/.local/bin/mv
-
Add
~/.local/binto thePATH:Add the directory to your
PATHby editing your shell configuration file (e.g.,.bashrcor.zshrc):echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
Then, reload your shell:
source ~/.bashrc
Now, when you use cp, mv, the wrapper scripts will be executed, providing progress bars.