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.

27.7.2024
#!/bin/bash
# Creator: Todor Uzunov a.k.a. Teo
# License: GNU - free like free speech and free beer for everybody!
VERSION=27.07.2024
# Changelog: added vnstat, sysz, netscanner

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" "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 " Netscanner. Exit with q" "sudo netscanner" # pamac install netscanner
	44 " Show all network connections of an app (paste name or pid)" "read nethog; ss -tuap | grep \$nethog"
	45 " Whois (paste ip address)" "read ipaddress; whois \$ipaddress"
	46 " 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
	47 " Read sensors every second, press CTRL-C to exit" "watch -e -n 1 sensors"
	48 " Stress the CPU, useful for thermal or throttling tests, press CTRL-C to exit" "stress -c 16"
	49 " Traffic statistic for the last days and current month (vnstat)" "vnstat -d --style 0 --limit 5 | grep -v estimated && vnstat -m --style 0 --limit 3 | grep -v estimated" # install vnstat and start daemon
	50 " Fuzzy search in systemd services. Exit with esc" "sudo sysz" # pamac build sysz
	51 " Temporary disable Ideapad battery conservation mode" "sudo conservation_mode.sh 0" # pamac build conservation_mode
)
# last unique tag number is 51

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
Ver 02.09.2024 - replaced dmesg with journalctl -k
#!/bin/bash
# Creator: Todor Uzunov a.k.a. Teo
# License: GNU - free like free speech and free beer for everybody!
VERSION=02.09.2024
# Changelog from last version: replaced dmesg with journalctl -k

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 kernel log" "journalctl -k"
	18 " Check for coredumps" "coredumpctl"
	19 " Clear coredumps on disk" "sudo rm -f /var/lib/systemd/coredump/*" #normally runs biweekly automatically
	20 " Regenerate hashes for the boot files after update" "sudo /root/verifier.sh -update" # requires the extra script, see my other topic
	21 " Regenerate hashes for rkhunter after update" "sudo rkhunter --propupd" # pamac install rkhunter
	22 " 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
	23 " Trim the root of the SSD" "sudo fstrim -v /" #normally run weekly
	24 " S.M.A.R.T. status of the disk and write cycles" "sudo smartctl --all /dev/nvme0" # smartctl --scan
	25 " Run wavemonitor to check Wifi channel and strength" "wavemon" # pamac install wavemon
	26 " List wifi networks around with strength and channel" "nmcli dev wifi"
	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 " Netscanner. Exit with q" "sudo netscanner" # pamac install netscanner
	44 " Show all network connections of an app (paste name or pid)" "read nethog; ss -tuap | grep \$nethog"
	45 " Whois (paste ip address)" "read ipaddress; whois \$ipaddress"
	46 " 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
	47 " Read sensors every second, press CTRL-C to exit" "watch -e -n 1 sensors"
	48 " Stress the CPU, useful for thermal or throttling tests, press CTRL-C to exit" "stress -c 16"
	49 " Traffic statistic for the last days and current month (vnstat)" "vnstat -d --style 0 --limit 5 | grep -v estimated && vnstat -m --style 0 --limit 3 | grep -v estimated" # install vnstat and start daemon
	50 " Fuzzy search in systemd services. Exit with esc" "sudo sysz" # pamac build sysz
	51 " Temporary disable Ideapad battery conservation mode" "sudo conservation_mode.sh 0" # pamac build conservation_mode
)
# last unique tag number is 51

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


4 Likes
27.09.24 - added listing processes listening on the network
#!/bin/bash
# Creator: Todor Uzunov a.k.a. Teo
# License: GNU - free like free speech and free beer for everybody!
VERSION=27.09.2024
# Changelog from last version: added listing all network server processes

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 kernel log" "journalctl -k"
	18 " Check for coredumps" "coredumpctl"
	19 " Clear coredumps on disk" "sudo rm -f /var/lib/systemd/coredump/*" #normally runs biweekly automatically
	20 " Regenerate hashes for the boot files after update" "sudo /root/verifier.sh -update" # requires the extra script, see my other topic
	21 " Regenerate hashes for rkhunter after update" "sudo rkhunter --propupd" # pamac install rkhunter
	22 " 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
	23 " Trim the root of the SSD" "sudo fstrim -v /" #normally run weekly
	24 " S.M.A.R.T. status of the disk and write cycles" "sudo smartctl --all /dev/nvme0" # smartctl --scan
	25 " Run wavemonitor to check Wifi channel and strength" "wavemon" # pamac install wavemon
	26 " List wifi networks around with strength and channel" "nmcli dev wifi"
	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 " Netscanner. Exit with q" "sudo netscanner" # pamac install netscanner
	44 " Show all network connections of an app (paste name or pid)" "read nethog; ss -tuap | grep \$nethog"
	45 " Whois (paste ip address)" "read ipaddress; whois \$ipaddress"
	46 " List all processes, listening on a network port" "sudo netstat -tulpn"
	47 " 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
	48 " Read sensors every second, press CTRL-C to exit" "watch -e -n 1 sensors"
	49 " Stress the CPU, useful for thermal or throttling tests, press CTRL-C to exit" "stress -c 16"
	50 " Traffic statistic for the last days and current month (vnstat)" "vnstat -d --style 0 --limit 5 | grep -v estimated && vnstat -m --style 0 --limit 3 | grep -v estimated" # install vnstat and start daemon
	51 " Fuzzy search in systemd services. Exit with esc" "sudo sysz" # pamac build sysz
	52 " Temporary disable Ideapad battery conservation mode" "sudo conservation_mode.sh 0" # pamac build conservation_mode
)
# last unique tag number is 52

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

2 Likes

Thanks.

Even though I don’t use it, I like to see how it’s progressing.

Cheers.

1 Like

Got inspired from the recent cups events to add sudo netstat -tulpn. One can see expected and unexpected stuff. I for example did not know networkmanager is constantly listening for who knows what… (according to one forum something to do with dhcp)

Well, listening for potential traffic comes to mind (possible connections).

The first thing that comes to mind is the ‘check network status’ that I usually disable.

as defined by

/usr/lib/NetworkManager/conf.d/20-connectivity.conf

and often overridden with something like

/etc/NetworkManager/conf.d/20-connectivity.conf

https://wiki.archlinux.org/title/NetworkManager#Checking_connectivity

Checking network status is an outgoing connection, not incoming. Could have been a vpn server part, but i do not have a server. Maybe something with libvirt…or dhcp, although i do not see the logic.

I’ve hesitated to ask this because if not careful it could kill a system from running.
But how about a kernel cleanup choice. Maybe that doesn’t fit in this kind of script.
The reason why I am asking is I keep 2 kernels active on my system sometimes 3 and as I do updates new kernel versions come in. The old ones stay also. Like 6.10.10-2 and then that gets replaced with 6.10.10-3 for example and 6.10.10-2 remains. Well after a while it takes a long time to update when kernels get updated. I guess because I also use DKMS and the updates take a long time to finish. The more kernel versions you have the longer it takes. This gets annoying for me.
So I end up doing a manual cleanup of modules . I was thinking of writing a script to do this from time to time.
The problem is this is a “not everyone needs this” I guess scenario.
Anyway what do you think.
Maybe this should be a topic all to itself.
Thanks

It indeed needs another topic, because it is a specific problem/config in your system - it does not generally happen. The old subversions do not stay. But i do not use dkms, maybe it has something to do with it, i do not know.

ver 29.9.24 - cache cleaning for yay, pamac and pacman
#!/bin/bash
# Creator: Todor Uzunov a.k.a. Teo
# License: GNU - free like free speech and free beer for everybody!
VERSION=29.09.2024
# Changelog from last version: cache cleaning with yay to include its cache too

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 YAY, Pacman and Pamac cache" "yay -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 kernel log" "journalctl -k"
	18 " Check for coredumps" "coredumpctl"
	19 " Clear coredumps on disk" "sudo rm -f /var/lib/systemd/coredump/*" #normally runs biweekly automatically
	20 " Regenerate hashes for the boot files after update" "sudo /root/verifier.sh -update" # requires the extra script, see my other topic
	21 " Regenerate hashes for rkhunter after update" "sudo rkhunter --propupd" # pamac install rkhunter
	22 " 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
	23 " Trim the root of the SSD" "sudo fstrim -v /" #normally run weekly
	24 " S.M.A.R.T. status of the disk and write cycles" "sudo smartctl --all /dev/nvme0" # smartctl --scan
	25 " Run wavemonitor to check Wifi channel and strength" "wavemon" # pamac install wavemon
	26 " List wifi networks around with strength and channel" "nmcli dev wifi"
	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 " Netscanner. Exit with q" "sudo netscanner" # pamac install netscanner
	44 " Show all network connections of an app (paste name or pid)" "read nethog; ss -tuap | grep \$nethog"
	45 " Whois (paste ip address)" "read ipaddress; whois \$ipaddress"
	46 " List all processes, listening on a network port" "sudo netstat -tulpn"
	47 " 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
	48 " Read sensors every second, press CTRL-C to exit" "watch -e -n 1 sensors"
	49 " Stress the CPU, useful for thermal or throttling tests, press CTRL-C to exit" "stress -c 16"
	50 " Traffic statistic for the last days and current month (vnstat)" "vnstat -d --style 0 --limit 5 | grep -v estimated && vnstat -m --style 0 --limit 3 | grep -v estimated" # install vnstat and start daemon
	51 " Fuzzy search in systemd services. Exit with esc" "sudo sysz" # pamac build sysz
	52 " Temporary disable Ideapad battery conservation mode" "sudo conservation_mode.sh 0" # pamac build conservation_mode
)
# last unique tag number is 52

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

Since pamac gui is again broken since several weeks and messes its own aur database looks like this will be needed very frequently, before i search for an aur package in the gui

ver 04.01.2025 - removed pacman -Syyu and added pamac update --aur --force-refresh
#!/bin/bash
# Creator: Todor Uzunov a.k.a. Teo
# License: GNU - free like free speech and free beer for everybody!
VERSION=04.01.2025
# Changelog from last version: removed pacman -Syyu and added pamac update --aur --force-refresh

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 and fix AUR database in pamac" "pamac update --aur --force-refresh"
	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 YAY, Pacman and Pamac cache" "yay -Scc" # pamac install yay
	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 kernel log" "journalctl -k"
	18 " Check for coredumps" "coredumpctl"
	19 " Clear coredumps on disk" "sudo rm -f /var/lib/systemd/coredump/*" #normally runs biweekly automatically
	20 " Regenerate hashes for the boot files after update" "sudo /root/verifier.sh -update" # requires the extra script, see my other topic
	21 " Regenerate hashes for rkhunter after update" "sudo rkhunter --propupd" # pamac install rkhunter
	22 " 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
	23 " Trim the root of the SSD" "sudo fstrim -v /" #normally run weekly
	24 " S.M.A.R.T. status of the disk and write cycles" "sudo smartctl --all /dev/nvme0" # smartctl --scan
	25 " Run wavemonitor to check Wifi channel and strength" "wavemon" # pamac install wavemon
	26 " List wifi networks around with strength and channel" "nmcli dev wifi"
	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 " Netscanner. Exit with q" "sudo netscanner" # pamac install netscanner
	44 " Show all network connections of an app (paste name or pid)" "read nethog; ss -tuap | grep \$nethog"
	45 " Whois (paste ip address)" "read ipaddress; whois \$ipaddress"
	46 " List all processes, listening on a network port" "sudo netstat -tulpn"
	47 " 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
	48 " Read sensors every second, press CTRL-C to exit" "watch -e -n 1 sensors"
	49 " Stress the CPU, useful for thermal or throttling tests, press CTRL-C to exit" "stress -c 16"
	50 " Traffic statistic for the last days and current month (vnstat)" "vnstat -d --style 0 --limit 5 | grep -v estimated && vnstat -m --style 0 --limit 3 | grep -v estimated" # install vnstat and start daemon
	51 " Fuzzy search in systemd services. Exit with esc" "sudo sysz" # pamac build sysz
	52 " Temporary disable Ideapad battery conservation mode" "sudo conservation_mode.sh 0" # pamac build conservation_mode
)
# last unique tag number is 52

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

Hello Teo,

thanks for your script, I tryed the new one and in a dark room. It blinds my eyes :joy:
Is there a possibility for a dark mode?
Or a darker Version?

Many thanks for your work

Greetings
Tony

I might have some spare sunglasses. :sunglasses:

1 Like

There is no specific theming at all. Xdialog is a gtk program and runs with the system theme for gtk apps, which should be fine on xfce and gnome.
Have not really tested on plasma. I think there is the analog of Xdialog called Kdialog but the syntax is slightly different so some tweaking will be needed.

Thank you Teo

My Linux Manjaro knowledge is that of an experienced user. If only after your script dialog and xdialog were installed on Plasma.

The console only opens with (I think) blue text and a white background.
At the bottom right it briefly appears that if I want buttons (sudo pacman -S gtk-engine-murrine ) should be executed.

After that your dialog window opens correctly with white text and a dark background.

All good
Thanks
Tony