Article · Wikipedia archive · Last revised May 29, 2026

TMPDIR

TMPDIR is the canonical environment variable in Unix and POSIX that should be used to specify a temporary directory for scratch space. Most Unix programs will honor this setting and use its value to denote the scratch area for temporary files instead of the common default of /tmp or /var/tmp.

Last revised
May 29, 2026
Read time
≈ 1 min
Length
182 w
Citations
5
Source

TMPDIR is the canonical environment variable in Unix and POSIX1 that should be used to specify a temporary directory for scratch space. Most Unix programs will honor this setting and use its value to denote the scratch area for temporary files instead of the common default of /tmp23 or /var/tmp.4

Other forms sometimes accepted are TEMP, TEMPDIR and TMP, but these alternatives are used more commonly by non-POSIX operating systems or non-conformant programs.

TMPDIR is specified in various Unix and similar standards, e.g. per the Single UNIX Specification.5

See also

See also

References

References