My Manjaro cheatsheet in a menu form

A few small additions, as per the changelog in the first lines of the script

ver 17.5.2024
#!/bin/bash
# Creator: Todor Uzunov 
# License: GNU - free like free speech and free beer for everybody!
# Version: 17.05.2024
# added mapare and stress; and loop for sensors; flatpak cache clean does not need sudo, removed; hidden the tags (it is tedious to renumber when i add smth)

MODE=Xdialog
# check if dependencies are present and fall back to dialog
if ! [[ "$(which dialog)" =~ (dialog) ]] &>/dev/null; then
if ! [[ "$(which Xdialog)" =~ (Xdialog) ]] &>/dev/null; then
	echo "Xdialog dependency is not found, please install with: sudo pacman -S xdialog"
	echo "Alternatively for TUI version install dialog: 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) ]] &>/dev/null; then
	echo "Libmurrine dependency is not found, please install with: sudo pacman -S gtk-engine-murrine"
	echo "Alternatively for TUI version install dialog: sudo pacman -S xdialog"
	exit 1
fi
else
if ! [[ "$(which Xdialog)" =~ (Xdialog) ]]; then
	MODE=dialog
	if [[ "$(which notify-send)" =~ (notify-send) ]]; then notify-send "Xdialog dependency is not found, please install with"  "sudo pacman -S xdialog"; fi
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
	MODE=dialog
	if [[ "$(which notify-send)" =~ (notify-send) ]]; then notify-send "libmurrine dependency is not found, please install with"  "sudo pacman -S gtk-engine-murrine"; fi
fi
fi
OPTIONS=(
	1 " Mirror Sync status and branch" "pacman-mirrors"
	2 " Refresh the mirror list" "sudo pacman-mirrors -f" # 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 (only for emergencies)" "sudo pacman -Syyu"
	6 " Run pacdiff with Meld to compare changed configs" "DIFFPROG=meld pacdiff -s" # pamac install meld
	7 " List foreign (AUR) packages" "pacman -Qm"
	8 " List orphaned packages" "pacman -Qdt"
	9 " Check for updates of AUR with YAY, do not update" "yay -Qua" # pamac install yay
	10 " Update only AUR packages with YAY" "yay -Sua" # pamac install yay
	11 " Pamac update AUR packages" "pamac update --aur"
	12 " Remove orphaned packages" "sudo pacman -Rsu \$(pacman -Qtdq)"
	13 " Clean Pacman and Pamac cache" "sudo pacman -Scc"
	14 " Show journal errors from current boot" "journalctl -b -p3 --no-pager"
	15 " Show journal errors from previous boot" "journalctl -b -1 -p3 --no-pager"
	16 " Show systemd bootlog only" "journalctl -b -t systemd"
	17 " Show dmesg" "sudo dmesg"
	18 " Check for coredumps" "coredumpctl"
	19 " List coredumps on disk and used space" "du -sh /var/lib/systemd/coredump/"
	20 " Clear coredumps on disk" "sudo rm -f /var/lib/systemd/coredump/*"
	21 " Trim the root of the SSD" "sudo fstrim -v /"
	22 " S.M.A.R.T. status of the disk and write cycles" "sudo smartctl --all /dev/nvme0" # smartctl --scan
	23 " Run wavemonitor to check Wifi channel and strength with wavemon" "wavemon" # pamac install wavemon
	24 " Read sensors every second, press CTRL-C to exit" "watch -e -n 1 sensors"
	25 " Stress the CPU, useful for thermal or throttling tests, press CTRL-C to exit" "stress -c 16"
	26 " Gather system info with inxi (filtered)" "inxi -zv8"
	27 " Update database for locate" "sudo updatedb"
	28 " Temporary disable Ideapad battery conservation mode" "sudo conservation_mode.sh 0" # pamac build conservation_mode
	29 " Show hidden spaceeaters above 100M in HOME" "du -sh -t +100M ~/.cache/* ~/.config/* ~/.local/share/*"
	30 " Use MAPARE to check if missing default packages" "bash <(curl -s https://gitlab.com/cscs/mapare/-/raw/main/mapare) -IP"
	31 " Check for missing files from packages" "sudo pacman -Qk 2>/dev/null | grep -v ' 0 missing files' "
	32 " Which package owns an existing file (paste filepath)" "read fileowner; pacman -Qo \$fileowner"
	33 " Which (installed or not) package contains a file (paste filename)" "read whogotit; sudo pacman -Fyx \$whogotit"
	34 " Check for flatpak updates and update" "flatpak update"
	35 " Remove orphaned (unused) flatpak runtimes" "flatpak uninstall --unused"
	36 " Clean flatpak cache" "rm -rfv /var/tmp/flatpak-cache-*"
	37 " Clean tmp bash history files and Totem stream cache" "rm -f ~/.bash_history-*.tmp && rm -f ~/.cache/totem/stream-buffer/*"
	38 " A 10-20 sec. cpu benchmark using bc to calculate PI" "time echo \"scale=5000; 4*a(1)\" | bc -l > /dev/null" # pamac install bc
	39 " Show journal size" "journalctl --disk-usage"
	40 " Cut journal to 2 weeks" "sudo journalctl --vacuum-time=2weeks"
)
while true; do
CHOICE=$($MODE --clear \
		--no-shadow \
		--no-tags \
		--item-help \
		--keep-tite \
		--scrollbar \
		--ok-label "Run" \
		--cancel-label "Exit" \
                --backtitle "" \
                --title "A Manjaro cheatsheet by Teo, ver. 17.05.24" \
		--menu "Press Enter to run a command, close the window to exit:" \
                78 120 0 \
                "${OPTIONS[@]}" \
                2>&1 >/dev/tty)
#clear
[[ $CHOICE ]] || break
echo "${OPTIONS[$(($(($CHOICE*3))-1))]}"
eval "${OPTIONS[$(($(($CHOICE*3))-1))]}"
read -n 1 -s -r -p "Press any key to return to menu or q to exit." $REPLY;
echo ""
echo ""
echo "================================================="
echo ""
if [[ $REPLY == "q" ]]; then break; fi
done

And it occurred to me i never actually posted a screenshot:

1 Like