- Ubuntu alias: https://doc.ubuntu-fr.org/alias
- apt update: https://linuxhint.com/apt-update-command/
- script.sh: https://www.tutorialspoint.com/unix/shell_scripting.htm
- Debian Facile: https://debian-facile.org/doc:programmation:bash:alias
Create folder "~/scripts"
mkdir ~/scripts
Create file "~/scripts/update.sh"
nano ~/scripts/update.sh
Copy this code below and pas on "update.sh":
#! /bin/bash
echo "UPDATE: processing ..."
sudo apt update && sudo apt upgrade -y && sudo apt clean && sudo apt autoremove && sudo apt autoclean
echo "UPDATE: Termined with Success ..."
(quit nano ctrl + x enter enter)
For exec "update.sh"
chmod +x ~/scripts/update.sh
Warn .bashrc file is very important file !!!
sudo cp ~/.bashrc ~/bashrc.copy
sudo nano ~/.bashrc
add this line at the top on ".bashrc"
# Alias
alias update="~/scripts/update.sh"
(quit nano ctrl + x enter enter)
Source the file:
source ~/.bashrc
And test your command (alias):
update
if all is ok delete your bashrc.copy
The best practice want edit (or create) the ~/.bash_aliases
└──╼ $ cat .bash_aliases
alias update='sudo apt update'
Warn you cant add similary alias on .bashrc and .bash_aliases !!!
if you look on .bashrc you read this
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
Enjoy'