Linux Mint 21.1 Cinnamon
As a newbie to writing Bash scripts, I wanted a single command that I could run and streamline all the updating and cleanup that I used to run ‘by hand’. Below is what I came up with. I prefixed all the little aliases with “J” because my first name is Jim and I wanted something easy to remember for my feeble mind. Now, I open a terminal and run “jall” which includes all of the commands that I used to run manually.
I’d be grateful for any corrections, comments or suggestions to my attempt. I inserted this code by copying and pasting directly into .bashrc rather than reading all about aliases and creating a seperate file - just lazy. There’s a lot of extra unnecessary code that adds color to the comments as jall runs.
Best, Jim
(Couldn’t figure out how to attach this as a text document so, here it is.)
#**************************************************************************
Jim’s custom aliases - edit with gedit ~/.bashrc (jma alias)
#**************************************************************************
alias jda=“cat ‘Jims Custom Aliases.txt’” # Jims Custom Aliases Display - jda
alias jch=“history -c && history -w” # Jims clear bash history - jch
Jims update/upgrade -y - juu
#alias juu="echo ‘*****************’ && echo ’ Updating and Upgrading…’
alias juu=“echo -e ‘$EINS \033[1;33m\033[40m *** Updating and Upgrading… \033[0m’ && sudo apt update && sudo apt upgrade -y”
Jims flatpak update -y - jfu
sudo flatpak update -y
alias jfu=“echo -e ‘$EINS \033[1;33m\033[40m *** Flatpak update… \033[0m’ && sudo flatpak update -y”
alias jju=“journalctl --disk-usage” # Jims journal usage - jju
Jims journal clean - jjc
alias jjc=“echo -e ‘$EINS \033[1;33m\033[40m *** Clean journal… \033[0m’ && sudo journalctl --vacuum-time=3d”
alias jcd=“du -sh ~/.cache/thumbnails” # Jims cache display - jcd
Jims cache cleanup - jcc
alias jcc=“echo -e ‘$EINS \033[1;33m\033[40m *** Clean cache… \033[0m’ && rm -rf ~/.cache/thumbnails/*”
Jims autoremove -y - jar
alias jar=“echo -e ‘$EINS \033[1;33m\033[40m *** autoremove \033[0m’ && sudo apt autoremove -y”
Jims autoclean - jac
alias jac=“echo -e ‘$EINS \033[1;33m\033[40m *** autoclean \033[0m’ && sudo apt autoclean”
Jims update db for mlocate - jud
alias jud=“echo -e ‘$EINS \033[1;33m\033[40m *** Update database… \033[0m’ && sudo updatedb”
Jims fix broken packages - jfb
alias jfb=“echo -e ‘$EINS \033[1;33m\033[40m *** Fix broken packages… \033[0m’ && sudo apt-get -f install”
Jims fix configuration - jfc
alias jfc=“echo -e ‘$EINS \033[1;33m\033[40m *** Fix configuration… \033[0m’ && sudo dpkg --configure -a”
Jims check rootkit -q - jroot
alias jroot="echo -e '$EINS \033[1;33m\033[40m ‘********************’ && echo -e ‘$EINS \033[1;33m\033[40m *** Check rootkit… \033[0m’ \
sudo chkrootkit -q"
alias jroot=“echo -e ‘$EINS \033[1;33m\033[40m *** Check rootkit… \033[0m’ && sudo chkrootkit -q”
Jims safe-upgrade - jsu
sudo aptitude safe-upgrade -y
alias jsu=“echo -e ‘$EINS \033[1;33m\033[40m *** Aptitude safe-upgrade… \033[0m’ && sudo aptitude safe-upgrade -y”
Jims save softs.list - jsl
sudo dpkg --get-selections | grep -v deinstall >softs.list
alias jsl=“echo -e ‘$EINS \033[1;33m\033[40m *** Save softs.list… \033[0m’ && sudo dpkg --get-selections | grep -v deinstall >softs.list”
alias jall=“juu && jfu && jsu && jjc && jcc && jfb && jfc && jar && jac && jroot && jud && jsl” # - jall
alias jma=“gedit ~/.bashrc” # Jims maintain aliases - jma
#**************************************************************************