My Manjaro cheatsheet in a menu form

I was just trying to politely hint you it might be something on your end.
I just tested with the latest live KDE 6 ISO and after installing the 2 dependencies it works.
It actually helped me discover a small error in the dependencies help hints which i now corrected.

I feel so stupid. Don’t know where I missed it or it was just common sense.
It work fine when I type sudo to begin the script.

Well…since just showing the menu does not require sudo (only some part does and it asks for it), that means there is something on your system with the wrong permissions. Maybe at some point in the past you run some external script with sudo where you shouldn’t have to, or did sudo npm, or sudo pip, or something similar.

I somehow missed this when I read this thread before. It’s what I do with the aliases I add to my ~/.bashrc, e.g. the one I use for the WAN speed test.

11.7.2024
#!/bin/bash
# Creator: Todor Uzunov a.k.a. Teo
# License: GNU - free like free speech and free beer for everybody!
VERSION=11.07.2024
# Changelog: bugfix - exit with Q

MODE=Xdialog
# check if dependencies are present and fall back to dialog. You can also change the variable manually above
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 dialog"
	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 dialog"
	exit 1
fi
else
if ! [[ "$(which Xdialog)" =~ (Xdialog) ]]; then
	MODE=dialog
	if [[ "$(which notify-send)" =~ (notify-send) ]]; then notify-send "If you want GUI you can install Xdialog 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 "If you want GUI you can install libmurrine 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/*" #normally run biweekly
	21 " Regenerate hashes for the boot files after update" "sudo /root/verifier.sh -update" # requires the extra script, see my other topic
	22 " Regenerate hashes for rkhunter after update" "sudo rkhunter --propupd" # pamac install rkhunter
	23 " Check for changed files with rkhunter" "sudo rkhunter --check" # rkhunter is abandoned, you can ctrl-c after the hash check because the rest is outdated
	24 " Trim the root of the SSD" "sudo fstrim -v /" #normally run weekly
	25 " S.M.A.R.T. status of the disk and write cycles" "sudo smartctl --all /dev/nvme0" # smartctl --scan
	26 " Run wavemonitor to check Wifi channel and strength with wavemon" "wavemon" # pamac install wavemon
	27 " Gather system info with inxi (filtered)" "inxi -zv8"
	28 " Update database for locate" "sudo updatedb" #normally run weekly
	29 " Use MAPARE to check if missing default packages" "bash <(curl -s https://gitlab.com/cscs/mapare/-/raw/main/mapare) -IP"
	30 " Check for missing files from packages" "sudo pacman -Qk 2>/dev/null | grep -v ' 0 missing files' "
	31 " Which package owns an existing file (paste filepath)" "read fileowner; pacman -Qo \$fileowner"
	32 " Which (installed or not) package contains a file (paste filename, online check)" "read whogotit; sudo pacman -Fyx \$whogotit"
	33 " Which (installed) package contains a file or directory (paste filename or path, offline check)" "read whogotit; pacman -Qo \$whogotit"
	34 " Check Appimage and Github Apps for updates" "\$HOME/Applications/appimageupdater5.sh" # requires the extra script, see my other topic
	35 " Check for flatpak updates and update" "flatpak update"
	36 " Remove orphaned (unused) flatpak runtimes" "flatpak uninstall --unused"
	37 " Clean flatpak cache" "rm -rfv /var/tmp/flatpak-cache-*"
	38 " Clean tmp bash history files and Totem stream cache" "rm -f ~/.bash_history-*.tmp && rm -f ~/.cache/totem/stream-buffer/*"
	39 " Show hidden spaceeaters above 100M in HOME" "du -sh -t +100M ~/.cache/* ~/.config/* ~/.local/share/*"
	40 " Show journal size" "journalctl --disk-usage"
	41 " Cut journal to 2 weeks" "sudo journalctl --vacuum-time=2weeks" # that probably also sets it fixed on 2 weeks
	42 " Display the apps making most network traffic. Exit with q" "sudo nethogs" # pamac install nethogs
	43 " Show all network connections of an app (paste name or pid)" "read nethog; ss -tuap | grep \$nethog"
	44 " Whois (paste ip address)" "read ipaddress; whois \$ipaddress"
	45 " 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
	46 " Read sensors every second, press CTRL-C to exit" "watch -e -n 1 sensors"
	47 " Stress the CPU, useful for thermal or throttling tests, press CTRL-C to exit" "stress -c 16"
	48 " Temporary disable Ideapad battery conservation mode" "sudo conservation_mode.sh 0" # pamac build conservation_mode
)
# last unique tag number is 48

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, version $VERSION" \
		--menu "Press Enter to run a command from the list or close the window to cancel:" \
                79 125 0 \
                "${OPTIONS[@]}" \
                2>&1 >/dev/tty)
[[ $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


1 Like