Peeter Joot's (OLD) Blog.

Math, physics, perl, and programming obscurity.

Posts Tagged ‘unix’

$TMPDIR environment variable.

Posted by peeterjoot on June 20, 2011

/tmp filling up on Unix is a pain in the butt. When it happens everybody is effected, and it can destabilize the machine. On many of our work machines home is configured much bigger, than /tmp, so it’s generally advisable to not use /tmp itself. I’ll always include something like the following in my .profile (or .bash_profile)

export TMPDIR=$HOME/tmp

(where I’ve run mkdir -p $HOME/tmp when creating my .profile initially). Many people don’t know that /tmp can be avoided, but most system commands (and many scripts that are written politely) will respect the $TMPDIR. It’s also easier to clean up your stuff since you don’t have to search /tmp/ for your stuff. When some of the $HOME’s are split onto different filesystems then systematic use of $TMPDIR can make it harder for one hog to bog down everybody.

I’d like to see the ramdisk /tmp/ used by default on Linux (we are using SLES11 for which this doesn’t appear to be a default), like it is on Solaris. Then every reboot things start off clean.

Posted in Development environment | Tagged: , , | Leave a Comment »