/tmp vs. /dev/shm for temp file storage on Linux? /tmp vs. /dev/shm for temp file storage on Linux? linux linux

/tmp vs. /dev/shm for temp file storage on Linux?


/dev/shm is intended for a very special purpose, not for files to be put to by arbitrary programs.

In contrast, /tmp is exactly made for this. On my systems, /tmp is a tmpfs as well, in contrast to /var/tmp which is designed for putting larger files, potentially staying longer.


It is essentially the same (shm is also backed implicitly by the disk when you have a swapfile).

/tmp has the advantage that it fills up harder (considering your hard disk is likely larger than your swapfile). And also it is more widely supported.