Update script (feedback appreciated)

I have created a custom update script that I would like to give back to the community.
It's a bash script that updates manjaro and safely removes old packages to save space and also updates and cleans some other stuff to keep your system up to date.
I am an amateur, but I'd like to hear your feedback

#filename: /b/pacman.sh
#make executable:
#chmod +x /b/pacman.sh

#update .bashrc:
#nano .bashrc
#export update="/b/pacman.sh"

#source .bashrc
#mkdir .tempaur
#usage: $update

#optimize mirrors
sudo pacman-mirrors -f 3

#update keyring
sudo pacman -Sy archlinux-keyring manjaro-keyring
sudo pacman-key --init
#sudo pacman-key --populate archlinux  # Updates pacman keys
#sudo pacman-key --populate manjaro    # Updates pacman keys
sudo pacman-key --populate archlinux manjaro
sudo pacman-key --refresh-keys  

#update system
sudo pacman -Syyu

#optimize database (dont use this command on ssd)
sudo pacman-optimize && sync

#remove unused packages (orphans)
sudo pacman -Rsn $(pacman -Qdtq)
#If you get this error, don't worry: it means you don't have orphaned packages to remove! 
#error: no targets specified (use -h for help)

#safely remove old packages
sudo paccache -rvk3

#remove all the cached packages that are not currently installed, and the unused sync database
sudo pacman -Sc

#upgrade pip
pip install --upgrade pip

#upgrade yaourt packages
#sudo yaourt -Syua
#yaourt -Syu --aur
#yaourt -Syua

#update aur packages with extra space, for flightgear for example
#rm -rf .tempaur
#mkdir .tempaur
yaourt -Syua --tmp ~/.tempaur

#remove yaourt orphaned packages
yaourt -Qdt

#remove pacman lock
#sudo rm /var/lib/pacman/db.lck

#clear sessions cache
rm -rf ~/.cache/sessions/*

#clear full cache
#rm -rf ~/.cache

#clear aur temp directory
#rm -rf .tempaur/*

#flush dns
sudo nscd -i hosts

#flush font cache
fc-cache -fv

#vacuum journalctl
sudo journalctl --vacuum-size=500M && sudo journalctl --vacuum-time=2d

gitlab url:

1 Like

I think this command has been deprecated.


you want re-write pacui ?

this script is only for you, its a normal usage or for repair ?:

  • fc-cache ? not in a pacman hook ?
  • yaourt ? ...
  • pacman-mirrors , why ? me i use always the same
  • is good to test return code - chaining without control is dangerous

You are using pip as root so you will have the infamous 'file exist on filesystem' error one day?

1 Like

sudo journalctl --vacuum-size=500M && sudo journalctl --vacuum-time=2d


pacui uses even more stuff to maintain a system. you can read its code and adopt (a.k.a. "copy and paste") some commands from there. here is the source code i am talking about

here is the documentation, if you want to know know more about those commands (it looks better, when you run "pacui help", but it is somewhat readable in source code form, too):

have fun toying around with your script!


I use it for normal usage to keep my system clean and up to date, but you could use it to attempt a repair.
However this script comes with absolutely no warranty as I am an amateur and may have made some mistakes. So use at own risk.

Due to the fact that it is open source, we can change, edit, and validate all the commands being run before we run it :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by