# Post your handy utility scripts!

**URL:** <https://forum.endeavouros.com/t/post-your-handy-utility-scripts/7213>\
**Category:** Community contributions\
**Created:** [August 21, 2020, 12:38pm UTC](https://forum.endeavouros.com/t/post-your-handy-utility-scripts/7213 "2020-08-21T12:38:24Z")\
**Posts on this page:** 1\
**Showing post:** 161

<div class="post-metadata">

**Author:** ![freebird54](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/freebird54/32/83106_2.png) [@freebird54](https://forum.endeavouros.com/u/freebird54)\
**Post date:** [January 24, 2022, 10:00am UTC](https://forum.endeavouros.com/t/post-your-handy-utility-scripts/7213/161 "2022-01-24T10:00:54Z")

</div>

EndeavourOS, in common with other Arch-based distros, nearly always has updates awaiting - which means a notifier isn’t as useful as it might be for some. For others, they don’t like the ‘attention-getting’ that a notifier specializes in. Sometimes you want to know more about the pending updates, though, and you usually want to know NOW!.

I had these scripts (actually implemented at the moment as bash functions) for a while, but they have been upgraded a bit lately (with some expert help).

Basically, on demand (that means when you call their name from a terminal 😁) you will get either a full count on what’s waiting (repos and AUR) with _ **upcnt** _ - or you get a formatted list of all awaiting updates, both repo and AUR. You also get a bonus with _ **upls** _ - it will tell you if theses updates are likely to require a reboot! This can be useful in deciding whether to update NOW, or at the end of your session…

Here they are:

> **upcnt**
>
> ```auto
> # Function to count available updates
> 
> upcnt() {
> # create vars
> NEWPKG=0
> NEWAUR=0
> 
> # count AUR and pacman updates
> NEWAUR=`yay -Qua | wc -l`
> NEWPKG=`checkupdates | wc -l`
> 
> # output RESULT
> if [[${NEWPKG} == 0 && ${NEWAUR} == 0]]; then
> RESULT="System up-to-date"
> else
> RESULT=$NEWPKG" Repo pkgs + "$NEWAUR" AUR pkgs need updating"
> fi
> echo $RESULT
> }
> 
> ```

> **upls**
>
> ```auto
> # Function to display listing of available updates
> # will also let you know if a reboot is likely to be needed
> 
> upls() {
> local updatesAUR=$(yay -Qua)
> local updates=$(checkupdates)
> 
> # output RESULT
> if [-n "$updates"] || [-n "$updatesAUR"]; then
> echo "Repo packages"
> echo "-------------"
> {
> echo "$updates"
> } | column -t -N Name,Current,"->",New
> echo " "
> if [-n "$updatesAUR"]; then
> echo " "
> echo "AUR Packages"
> echo "------------"
> {
> echo "$updatesAUR"
> } | column -t -N Name,Current,"->",New
> fi
> 
> #check for core system packages
> RUN_KERNEL=$(cat /proc/version | sed 's|.*(\([^@]*\)@archlinux).*|\1|')
> CHKLINE="amd-ucode\|intel-ucode\|btrfs-progs\|cryptsetup\|nvidia*\|mesa\|systemd*\|*wayland*\|xf86-video-*\|xorg-server*\|xorg-fonts*"
> CHKLINE+="\|""${RUN_KERNEL}"
> 
> echo " "
> echo $updates | grep -q ${CHKLINE} && echo "Reboot will be recommended due to the upgrade of core system package(s)." || echo "No reboot recommended after this update."
> else
> echo "No pending updates..."
> fi
> }
> 
> ```

As with any bash function, just paste it into your ~/.bashrc file - or into any such file that .bashrc calls (perhaps .bashrc-personal or .bash-functions?). Or, you could very easily turn them into scripts if you prefer. Enjoy!

---

_[View the full topic](https://forum.endeavouros.com/t/post-your-handy-utility-scripts/7213)._
