My Manjaro cheatsheet in a menu form

Since we advise beginner users to keep a list of commands on file, and it even has such article in the wiki

i decided to share with you my list of frequently used command. However, i decided i want it a bit more fancy and interactive, so i made it in form of a dialog menu. Here it is, my menu.sh

#!/bin/bash
# Creator: Todor Uzunov 
# License: GNU - free like free speech and free beer for everybody!
# Release: 12 Aug 2023
# New in this version: fixed orphan deletion

# check if dependency dialog is present
if ! [[ "$(which dialog)" =~ (dialog) ]]; then
	echo "dialog dependency is not found, please install with: sudo pacman -S dialog"
	exit 1
fi
#===MIN/NORM/MAX-WIDTH===============================================/==================================/=======================================/
OPTIONS=(
	1 "Mirror Sync status and branch || pacman-mirrors"
	2 "Refresh the mirror list || sudo pacman-mirrors -f5" # sudo pacman-mirrors --country Germany --api --protocol https
	3 "Update all without AUR || sudo pacman -Syu"
	4 "Download all updates for offline install later || sudo pacman -Syuw"
	5 "Force refresh database and update || sudo pacman -Syyu"
	6 "Refresh files database || sudo pacman -Fy"
	7 "Run pacdiff with Meld to compare changed configs || DIFFPROG=meld pacdiff -s" # pamac install meld
	8 "List foreign (AUR) packages || pacman -Qm"
	9 "List orphaned packages || pacman -Qdt"
	10 "Check for updates of AUR with YAY, do not update || yay -Qua" # pamac install yay
	11 "Update only AUR packages with YAY || yay -Sua" # pamac install yay
	12 "Pamac update AUR packages || pamac update --aur"
	13 "Remove orphaned packages || sudo pacman -Rsu ..."
	14 "Clean Pacman cache || sudo pacman -Scc"
	15 "Trim the root of the SSD || sudo fstrim -v /"
	16 "S.M.A.R.T. status of the disk and write cycles || sudo smartctl --all /dev/nvme0" # smartctl --scan
	17 "Show journal errors from current boot || journalctl -b -p3 --no-pager"
	18 "Show journal errors from previous boot || journalctl -b -1 -p3 --no-pager"
	19 "Dmesg || sudo dmesg"
	20 "Check for coredumps || coredumpctl"
	21 "Run Wavemonitor to check Wifi channel and strength || wavemon" # pamac install wavemon
	22 "Read sensors || sensors"
	23 "Gather system info || inxi -v7azy"
	24 "Update database for locate || sudo updatedb"
	25 "Temporary disable Ideapad battery conservation mode || sudo conservation_mode.sh 0" # pamac build conservation_mode
	26 "Show hidden spaceeaters above 100M in HOME || du -sh -t +100M ~/.cache/* ~/.config/* ~/.local/share/*"
	27 "Show journal size || journalctl --disk-usage"
	28 "Cut journal to one week || sudo journalctl --vacuum-time=1week"
	29 "List coredumps on disk and used space || du -sh /var/lib/systemd/coredump/"
	30 "Clear coredumps on disk || sudo rm -f /var/lib/systemd/coredump/*"
)
CHOICE=$(dialog --clear \
		--no-shadow \
		--scrollbar \
		--column-separator "||" \
                --backtitle "I love Manjaro" \
                --title "A Manjaro cheatsheet by Teo" \
                --menu "Choose an option (to see the full commands maximize window ->> ):" \
                200 200 200 \
                "${OPTIONS[@]}" \
                2>&1 >/dev/tty)
clear
case $CHOICE in
	1) echo "pacman-mirrors"; pacman-mirrors ;;
	2) echo "sudo pacman-mirrors -f5"; sudo pacman-mirrors -f5 ;;
	3) echo "sudo pacman -Syu"; sudo pacman -Syu ;;
	4) echo "sudo pacman -Syuw"; sudo pacman -Syuw ;;
	5) echo "sudo pacman -Syyu"; sudo pacman -Syyu ;;
	6) echo "sudo pacman -Fy"; sudo pacman -Fy ;;
	7) echo "DIFFPROG=meld pacdiff -s"; DIFFPROG=meld pacdiff -s ;;
	8) echo "pacman -Qm"; pacman -Qm ;;
	9) echo "pacman -Qdt"; pacman -Qdt ;;
	10) echo "yay -Qua"; yay -Qua ;;
	11) echo "yay -Sua"; yay -Sua ;;
	12) echo "pamac update --aur"; pamac update --aur ;;
	13) echo "sudo pacman -Rsu $(pacman -Qtdq)"; sudo pacman -Rsu $(pacman -Qtdq) ;;
	14) echo "sudo pacman -Scc"; sudo pacman -Scc ;;
	15) echo "sudo fstrim -v /"; sudo fstrim -v / ;;
	16) echo "sudo smartctl --all /dev/nvme0"; sudo smartctl --all /dev/nvme0 ;;
	17) echo "journalctl -b -p3 --no-pager"; journalctl -b -p3 --no-pager ;;
	18) echo "journalctl -b -1 -p3 --no-pager"; journalctl -b -1 -p3 --no-pager ;;
	19) echo "sudo dmesg"; sudo dmesg ;;
	20) echo "coredumpctl"; coredumpctl ;;
	21) echo "wavemon"; wavemon ;;
	22) echo "sensors"; sensors ;;
	23) echo "inxi -v7azy"; inxi -v7azy ;;
	24) echo "sudo updatedb"; sudo updatedb ;;
	25) echo "sudo conservation_mode.sh 0"; sudo conservation_mode.sh 0 ;;
	26) echo "du -sh -t +100M ~/.cache/* ~/.config/* ~/.local/share/*"; du -sh -t +100M ~/.cache/* ~/.config/* ~/.local/share/* ;;
	27) echo "journalctl --disk-usage"; journalctl --disk-usage ;;
	28) echo "sudo journalctl --vacuum-time=1week"; sudo journalctl --vacuum-time=1week ;;
	29) echo "du -sh /var/lib/systemd/coredump/"; du -sh /var/lib/systemd/coredump/ ;;
	30) echo "sudo rm -f /var/lib/systemd/coredump/*"; sudo rm -f /var/lib/systemd/coredump/* ;;
esac
# if we use a launcher shortcut with -launcher, pause before exit
if [ "$1" == "-launcher" ]; then
	read -n 1 -s -r -p "Press any key to close the window.";
fi

P.s. for the beginner users: save it as a file menu.sh in the ~/.local/bin hidden Folder (create if needed) then right click and in the permissions tab in properties select allow to execute as a program.
Then you can start in the terminal with menu.sh. You can even make a launcher on the panel, just don’t forget to set it to run in terminal and append -launcher at the end of the command. And if some subcommand does not work, check if you have the dependency in the comment on the corresponding line. Like this in a XFCE panel:
launcher-cheat

7 Likes

Very nice. the installacion of “/core/dialog” may be helpfull…
Remove orphaned packages tells “Argument missing”. (If none?)

Why not enable the fstrim.timer instead? See Solid state drive - ArchWiki

1 Like

@GaVenga No idea. I have to test when i have some orphans. For now i just read the man page.
@Yochanan it is enabled, once a week by default. It is just in case i want to do it manually, for example after a massive timeshift clean of hundreds of GB or something like that.

1 Like

Reminds me of https://cheat.sh/ or on Github https://github.com/chubin/cheat.sh.

Fixed orphans. It wanted an argument indeed

sudo pacman -Rsu $(pacman -Qtdq)
1 Like

I was little irritated because dialog cannot scroll with the mouse, so here is a remake with Xdialog:

#!/bin/bash
# Creator: Todor Uzunov 
# License: GNU - free like free speech and free beer for everybody!
# Release: 17 Aug 2023

# check if dependency Xdialog and gtk-engine-murrine are present 
if ! [[ "$(which Xdialog)" =~ (Xdialog) ]]; then
	echo "Xdialog dependency is not found, please install with: sudo pacman -S xdialog"
	exit 1
fi
if ! [[ "$(which /usr/lib/gtk-2.0/2.10.0/engines/libmurrine.so)" =~ (/usr/lib/gtk-2.0/2.10.0/engines/libmurrine.so) ]]; then
	echo "Libmurrine dependency is not found, please install with: sudo pacman -S gtk-engine-murrine"
	exit 1
fi
OPTIONS=(
	1 "Mirror Sync status and branch || pacman-mirrors"
	2 "Refresh the mirror list || sudo pacman-mirrors -f5" # sudo pacman-mirrors --country Germany --api --protocol https
	3 "Update all without AUR || sudo pacman -Syu"
	4 "Download all updates for offline install later || sudo pacman -Syuw"
	5 "Force refresh database and update || sudo pacman -Syyu"
	6 "Refresh files database || sudo pacman -Fy"
	7 "Run pacdiff with Meld to compare changed configs || DIFFPROG=meld pacdiff -s" # pamac install meld
	8 "List foreign (AUR) packages || pacman -Qm"
	9 "List orphaned packages || pacman -Qdt"
	10 "Check for updates of AUR with YAY, do not update || yay -Qua" # pamac install yay
	11 "Update only AUR packages with YAY || yay -Sua" # pamac install yay
	12 "Pamac update AUR packages || pamac update --aur"
	13 "Remove orphaned packages || sudo pacman -Rsu ..."
	14 "Clean Pacman cache || sudo pacman -Scc"
	15 "Trim the root of the SSD || sudo fstrim -v /"
	16 "S.M.A.R.T. status of the disk and write cycles || sudo smartctl --all /dev/nvme0" # smartctl --scan
	17 "Show journal errors from current boot || journalctl -b -p3 --no-pager"
	18 "Show journal errors from previous boot || journalctl -b -1 -p3 --no-pager"
	19 "Dmesg || sudo dmesg"
	20 "Check for coredumps || coredumpctl"
	21 "Run Wavemonitor to check Wifi channel and strength || wavemon" # pamac install wavemon
	22 "Read sensors || sensors"
	23 "Gather system info || inxi -v7azy"
	24 "Update database for locate || sudo updatedb"
	25 "Temporary disable Ideapad battery conservation mode || sudo conservation_mode.sh 0" # pamac build conservation_mode
	26 "Show hidden spaceeaters above 100M in HOME || du -sh -t +100M ~/.cache/* ~/.config/* ~/.local/share/*"
	27 "Show journal size || journalctl --disk-usage"
	28 "Cut journal to one week || sudo journalctl --vacuum-time=1week"
	29 "List coredumps on disk and used space || du -sh /var/lib/systemd/coredump/"
	30 "Clear coredumps on disk || sudo rm -f /var/lib/systemd/coredump/*"
)
CHOICE=$(Xdialog --clear \
		--no-shadow \
		--scrollbar \
		--column-separator "||" \
		--separator "||" \
		--separate-output \
                --backtitle "I love Manjaro" \
                --title "A Manjaro cheatsheet by Teo" \
                --menubox "Choose an option (to see the full commands maximize window ->> ):" \
                70 180 70 \
                "${OPTIONS[@]}" \
                2>&1 >/dev/tty)
#clear
case $CHOICE in
	1) echo "pacman-mirrors"; pacman-mirrors ;;
	2) echo "sudo pacman-mirrors -f5"; sudo pacman-mirrors -f5 ;;
	3) echo "sudo pacman -Syu"; sudo pacman -Syu ;;
	4) echo "sudo pacman -Syuw"; sudo pacman -Syuw ;;
	5) echo "sudo pacman -Syyu"; sudo pacman -Syyu ;;
	6) echo "sudo pacman -Fy"; sudo pacman -Fy ;;
	7) echo "DIFFPROG=meld pacdiff -s"; DIFFPROG=meld pacdiff -s ;;
	8) echo "pacman -Qm"; pacman -Qm ;;
	9) echo "pacman -Qdt"; pacman -Qdt ;;
	10) echo "yay -Qua"; yay -Qua ;;
	11) echo "yay -Sua"; yay -Sua ;;
	12) echo "pamac update --aur"; pamac update --aur ;;
	13) echo "sudo pacman -Rsu $(pacman -Qtdq)"; sudo pacman -Rsu $(pacman -Qtdq) ;;
	14) echo "sudo pacman -Scc"; sudo pacman -Scc ;;
	15) echo "sudo fstrim -v /"; sudo fstrim -v / ;;
	16) echo "sudo smartctl --all /dev/nvme0"; sudo smartctl --all /dev/nvme0 ;;
	17) echo "journalctl -b -p3 --no-pager"; journalctl -b -p3 --no-pager ;;
	18) echo "journalctl -b -1 -p3 --no-pager"; journalctl -b -1 -p3 --no-pager ;;
	19) echo "sudo dmesg"; sudo dmesg ;;
	20) echo "coredumpctl"; coredumpctl ;;
	21) echo "wavemon"; wavemon ;;
	22) echo "sensors"; sensors ;;
	23) echo "inxi -v7azy"; inxi -v7azy ;;
	24) echo "sudo updatedb"; sudo updatedb ;;
	25) echo "sudo conservation_mode.sh 0"; sudo conservation_mode.sh 0 ;;
	26) echo "du -sh -t +100M ~/.cache/* ~/.config/* ~/.local/share/*"; du -sh -t +100M ~/.cache/* ~/.config/* ~/.local/share/* ;;
	27) echo "journalctl --disk-usage"; journalctl --disk-usage ;;
	28) echo "sudo journalctl --vacuum-time=1week"; sudo journalctl --vacuum-time=1week ;;
	29) echo "du -sh /var/lib/systemd/coredump/"; du -sh /var/lib/systemd/coredump/ ;;
	30) echo "sudo rm -f /var/lib/systemd/coredump/*"; sudo rm -f /var/lib/systemd/coredump/* ;;
esac
# if we use a launcher shortcut with -launcher, pause before exit
if [ "$1" == "-launcher" ]; then
	read -n 1 -s -r -p "Press any key to close the window.";
fi

@Teo

you named it Xdialog but the package is named xdialog (lower-case x). this might confuse noobs if they will search for it to install it.

Thanks i fixed it.

1 Like