www.alxm.org

Linux Mint Notes

Here is a collection of Linux Mint notes on a variety of topics. I only tried these on the amd64 Cinnamon editions, and there may be some mistakes and omissions; please remember to backup your files before making any system changes!

Contents

Configure Redshift Manually#

Redshift is great for eye comfort in the evening, and sometimes I use it all day. Sadly, the internet location server it uses to determine dawn and dusk times has been retired in 2024, which makes Redshift crash at launch on Linux Mint 21 and 22.

Luckily, you can set the dawn and dusk times manually in $HOME/.config/redshift.conf and then Redshift and Redshift-GTK work as expected:

1
2
3
4
5
6
[redshift]
temp-day=6500
temp-night=3600
dawn-time=06:00-06:30
dusk-time=18:00-18:30
fade=1

Disable Swap on Linux Mint 19#

My computer doesn't have a lot of RAM, but I don't run anything too intense either. Since I do not need swap space, I would rather get the storage space back. However small that space is, now it will be put to good use by the SSD's wear leveling system.

The Linux Mint 18 installer lets you choose not to use a swap partition, but Linux Mint 19 always uses a swap file located at /swapfile instead of a separate file system partition. Here are the steps I used to turn it off:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#
# Turn off swap
#
$ sudo swapoff -a

#
# Edit file systems config
#
$ sudo nano /etc/fstab

    #
    # Comment out these lines, insert a `#` at the start of each
    #
    /swapfile none swap sw 0 0
    /dev/mapper/cryptswap1 none swap sw 0 0

#
# Edit encrypted block devices config
#
$ sudo nano /etc/crypttab
    #
    # Comment out this line:
    #
    cryptswap1 /swapfile /dev/urandom swap, ...

#
# Delete the file and reclaim some space! Mine was 1.4GB
#
$ ls -l /swapfile
$ sudo rm /swapfile

#
# Finally, reboot for changes to take effect
#
$ reboot

At first I only ran sudo swapoff -a without editing the files. This caused some issues that added 30 seconds to the kernel boot time according to systemd-analyze! The boot time is back to normal after doing all the others steps.


Fix Oversized Icons in the Cinnamon Panel#

When I upgraded to Cinnamon 4.4.8, I noticed that some of the panel tray icons, like WiFi, Battery, and Sound, were much larger than the others. This started to bother me after a while since Cinnamon otherwise looks so nice; here are the steps to fix this:

Before:
After:

Standard color icons have a handy option to auto-scale, but you have to adjust symbolic icons' size manually to absolute values.


Show the Time and Git Branch on the Shell Prompt#

I customized my Bash prompt to show the current time at the start of every line, and if inside a Git repo also the name of the current branch. This goes at the end of ~/.bashrc (to override any previously set PS1, the env var for the prompt's format string),

1
2
3
4
5
6
git_branch() {
    branch_name=$(git symbolic-ref --short HEAD 2>/dev/null)
    [ $? -eq 0 ] && echo "[$branch_name]"
}

export PS1='\t \u@\h \w$(git_branch) \$ '

The shell prompt should look something like this now:

1
2
3
4
18:44:05 alex@laptop ~ $
18:44:06 alex@laptop ~ $ mkdir MyProject && cd MyProject
18:44:14 alex@laptop ~/MyProject $ git init
18:44:20 alex@laptop ~/MyProject[master] $

Convenient Single-Letter Git Command Aliases#

I also keep a few short shell aliases for the Git commands I use the most day to day. All of them are for read-only actions - muscle memory for repetitive things is nice and all, until you get burned that one time at 1am...

1
2
3
4
5
6
alias b="git branch -a -vv"
alias d="git diff"
alias ds="git diff --staged"
alias h="git show"
alias l="git log --graph --decorate=full --pretty=medium"
alias s="git status"