Temp –

Little hacks I found useful and may need to refer to again later, cos it’s all so easy to forget. Raspberry Pi stuff is in its own page.

Completely remove snap from ubuntu

A tutorial on how to remove Snap from Ubuntu Linux and getting a snap-free system. seemed like a good page. Archived as pdf just in case. And there’s another one for comparison.

If it’s a fresh installation snapd may not even be installed yet. Try snap list to check. If it isn’t installed, use part 3 of the linked article to make sure it can’t be accidentally installed (e.g. sudo apt install firefox) This is an error I want to see…

Invert Screen Colors

(to overcome dark mode madness)

sudo apt-get install xcalib then use xcalib -i -a

Add keyboard shortcut:
Menu: open keyboard > shortcuts > custom shortcuts. Add a new shortcut (with the “+” button). The command should be “xcalib -i -a” or “/usr/bin/xcalib -i -a


DigitalOcean has a good description of why.

Set the automatic TRIM job to daily

sudo mkdir -v /etc/systemd/system/fstrim.timer.d
sudo touch /etc/systemd/system/fstrim.timer.d/override.conf
nano admin:///etc/systemd/system/fstrim.timer.d/override.conf

Then reboot, and to check, use

systemctl cat fstrim.timer

Confirm that you’ve successfully edited trim’s configuration by executing this terminal command:

systemctl cat fstrim.timer

Your output should look approximately like this:

# /lib/systemd/system/fstrim.timer
Description=Discard unused blocks once a week



# /etc/systemd/system/fstrim.timer.d/override.conf

Let’s take a closer look at this output. The first part shows the default setting (weekly), the second part shows the overriding setting that you’ve applied. That overriding setting contains two elements: first the existing OnCalendar setting (weekly) is being deleted by specifying nothing after the = sign, and then a new OnCalendar setting is being applied (daily).

If you ever want to check whether fstrim has actually happened, and when it happened, you can use this terminal command:

journalctl | grep fstrim.service

Want to undo? Remove the last 4 lines (the override.conf bit)

Limit swappiness to reduce writes

Decreasing the swappiness to a more reasonable level, namely 25:
check your current swappiness setting.

cat /proc/sys/vm/swappiness

The result will probably be 60.

sudo nano /etc/sysctl.conf

At the very end of the existing text:


Save the file and close, then reboot.


To reduce the number of writes. Has its own page.

Move Chromium Cache to RAM

Create RAM disk and set it to run at startup, make chromium use it instead of the SSD.

sudo gedit /etc/fstab

Add the following line to the bottom of the text file that opens but BE CAREFUL – do not touch, edit or enter ANYTHING else:

tmpfs /media/ramdisk tmpfs defaults,noatime,mode=1777 0 0, size=2048m

Once entered save and exit.

Head back to the terminal window, this time enter the following: –

sudo mkdir /media/ramdisk

create the script.

sudo nano ~/.chromecache

add this inside the textfile

#for the google chrome cache
/bin/rm ~/.cache/google-chrome
/bin/mkdir /media/ramdisk/google-chrome
/bin/ln -s /media/ramdisk/google-chrome ~/.cache/google-chrome
#for the chromium cache
/bin/rm -r ~/.cache/chromium
/bin/mkdir /media/ramdisk/chromium
/bin/ln -s /media/ramdisk/chromium ~/.cache

Save and exit.

Make the script executable by issuing:

sudo chmod +x ~/.chromecache

Now go to Preferences > Start-up Applications and add a new entry using the following field data: –Name: Chrome Cache
command: ~/.chromecache
comment: moving chrome browser cache to ramdisk

Disable Chromium Preloading

Settings > Privacy and Security > Cookies and site data
– Disable “Preload pages for faster browsing and searching”.

Linux Mint change notifications duration

The actual time on screen for transient notifications is hardcoded on /usr/share/cinnamon/js/ui/messageTray.js. Luckily it’s a plain text javascript file so amenable to end user tweaking (after making a backup and with elevated privileges)

The hard-coded values are near the start of the file and look like this. Time is in seconds.


NOTIFICATION_TIMEOUT is the default timeout

NOTIFICATION_CRITICAL_TIMEOUT_WITH_APPLET is used if the notification is flagged by the sending app as CRITICAL and the notification applet is present. If the applet is absent critical notifications won’t timeout.

So if you wanted to tweak
Make a back up

sudo cp /usr/share/cinnamon/js/ui/messageTray.js /usr/share/cinnamon/js/ui/messageTray.js.original

Open the file with elevated privileges

xed admin:///usr/share/cinnamon/js/ui/messageTray.js

Once tweaked and saved restart Cinnamon with Ctrl-Alt-Esc

Remove lock screen and logout from Cinnamon menu

  • Make a local copy of the menu applet: cp -r /usr/share/cinnamon/applets/ ~/.local/share/cinnamon/applets
  • open the original: xed ~/.local/share/cinnamon/applets/
  • // comment out everything in //Lock screen and //Logout button all the way down to the next //
  • Save the file and close the text editor.
  • Restart Cinnamon with Ctrl-Alt-Esc.

Reinstalling system

Disable window snapping

gsettings get org.cinnamon.muffin edge-tiling
  • this lists the current setting, which stubbornly stayed stuck on “true”. But type:
gsettings set org.cinnamon.muffin edge-tiling false

and the accursed tiling and snapping is gone !

Flush DNS cache

andy@HP3:~$ sudo resolvectl flush-caches

should work. If not try

sudo systemd-resolve --flush-caches

to check,use

$ sudo systemd-resolve --statistics
$ sudo resolvectl statistics

use statistics before and after to compare, shoul be zeroed after flush.

Apps to add

Now it’s own page.

Change Desktop Font Color

Create or edit gtk.css file in ~/.config/gtk-3.0: nano ~/.config/gtk-3/gtk.css

.nemo-desktop.nemo-canvas-item { color: #000000; text-shadow: 1px 1px @desktop_item_text_shadow; }

Then restart cinnamon (alt + f2 then r) or reboot if that doesn’t work.

If you changed Cinnamon settings e.g. to widen the scrollbar then it will add lines saying “do not edit” and the ffffff may still be in there.

Change Screenshot Save Location

gsettings set org.gnome.gnome-screenshot auto-save-directory '/home/yourpath'

Getting it

gsettings get org.gnome.gnome-screenshot auto-save-directory

Force browser to ignore SSL

chromium --ignore-certificate-errors

Change default screenshot destination

Enter this command replacing <username> with your username

gsettings set org.gnome.gnome-screenshot auto-save-directory 'file:///home/andy/Desktop'

The schema contains two keys – auto-save-directory and last-save-directory. The former applies when using short cut keys to take screenshots, the latter when launching the screenshot application directly from the menu.