Using the Temp Filesystem

The easiest way to use the temp file system is to create a personal temporary directory you can run your program in it.

$ mkdir -p /tmp/mydir 
$ cd /tmp/mydir
$ myprogram

***Remember***, that using the system this way, you’ll need to copy your final files back to home directory (i.e. /home/mydir)

Alternativelty if the program you’re using recognizes the environmental variable TMPDIR (e.g. ISE), you can set it to /tmp/mydir. This will use /tmp/mydir for temp files, but store your final work in your current working directory. Nice, because you don’t need to remember to copy anything back.

Add the following lines to your .bash_profile

$ mkdir -p /tmp/mydir
$ export TMPDIR=/tmp/mydir

Note the files in /tmp are stored with the permissions you set with umask, so they are generally secure. Also the /tmp directory is occassionally cleared by the OS — mostly on reboots — so it’s not a good place to store files long term.