If you have more than 4 GB of ram, you can make your /tmp be stored in the RAM memory, to speed up your system. In this article I will show you how to make the propper settings to use 512 RAMS for the /tmp.
Create a /tmp/ram directory:
$ mkdir -p /tmp/ram
Mount /tmp/ram with 512 MB size, as tmpfs:
sudo mount -t tmpfs -o size=512M tmpfs /tmp/ram/
Make this setting persistent by adding these line to your /etc/fstab file:
tmpfs /tmp tmpfs defaults,noatime,mode=1777,nosuid,size=512M 0 0
If you want other directories to be loaded in the ram memory, for exame /var/tmp, add this line to your /etc/fstab file:
tmpfs /var/tmp tmpfs defaults,noatime,mode=1755,nosuid,size=512M 0 0
Beware that when the tmpfs gets full, it will give you a “not enough space” error, that will be fixed after the first reboot, because the cache memory will get empty. However, if one command consumes more space than the tmpfs size, you’re in trouble.
If you have 8 GB or ram memory, you can use 1 GB for /tmp and 1 GB for /var/tmp and it may be enough, and your system will succesfully manage with 6 GB of ram.