Linux

Temp – https://easylinuxtipsproject.blogspot.com/p/upgrade-mint.html#ID2

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

SSD

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
[Unit]
Description=Discard unused blocks once a week
Documentation=man:fstrim
ConditionVirtualization=!container

[Timer]
OnCalendar=weekly
AccuracySec=1h
Persistent=true

[Install]
WantedBy=timers.target

# /etc/systemd/system/fstrim.timer.d/override.conf
[Timer]
OnCalendar=
OnCalendar=daily

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:

vm.swappiness=25

Save the file and close, then reboot.

Log2Ram

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

Move Chromium Cache to RAM

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

Disable Chromium Preloading

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

Now moved to chrome://settings/performance

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.

var NOTIFICATION_TIMEOUT = 4;
var NOTIFICATION_CRITICAL_TIMEOUT_WITH_APPLET = 10;

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/menu@cinnamon.org ~/.local/share/cinnamon/applets
  • open the original: xed ~/.local/share/cinnamon/applets/menu@cinnamon.org/applet.js
  • // 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
or
$ 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.

BUT!
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.

Install Tor Browser without all the KDE flatpak crap

The flatpak of Tor Browser has over 1GB of bloat in it so get the source instead
https://www.linuxcapable.com/how-to-install-tor-browser-on-debian-linux/

Install Telegram without flatpak

https://www.tecmint.com/install-telegram-in-linux
[link has gone, this works -jun 24- https://telegram.org/dl/desktop/linux will give the tar.gz and then proceed as per that page.

or better to move it to opt first

https://forums.linuxmint.com/viewtopic.php?t=221475

But that way I end up with a fairly useless desktop icon – so use combination of both – move to /opt and then do ./Telegram so you get it in the menu in the correct place.

Install Freetube without flatpak

https://freetubeapp.io/#download there is still a .deb available. flatpak has about 3Gb of bloat

Battery capacity / life

inxi -B