how to stop saving thumbnails in ~/.thumbnails

Requires root permissions

I solved this using tmpfs. The thumbnails remain in RAM until the next reboot and are recreated if needed again. Following two lines in /etc/fstab create tmpfs for both thumbnails directories:

none /home/username/.thumbnails tmpfs rw,noexec,nosuid,size=10%,uid=1000,gid=1000,mode=0755 0 0
none /home/username/.cache/thumbnails tmpfs rw,noexec,nosuid,size=10%,uid=1000,gid=1000,mode=0755 0 0

Replace username with your user name and 1000 with your UID and GID. (You can find these by executing the id in shell).

Now clear the directories and mount tmpfs to them.

rm -rf /home/username/.thumbnails/*
sudo mount /home/username/.thumbnails
rm -rf /home/username/.cache/thumbnails/*
sudo mount /home/username/.cache/thumbnails

Open file manager (Nautilus), then Edit > Preferences, and a small window will open like this:

Nautilus file manager

Set show thumbnails to never

After this delete all files in the ~/.thumbnails folder to make sure that all thumbnails are deleted and never created again