TMPDIR explained

TMPDIR is the canonical environment variable in Unix and POSIX[1] 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 [2] [3] or .[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

Notes and References

  1. Web site: Environment Variables. Pubs.opengroup.org. 26 October 2017.
  2. Web site: The Open Group Base Specifications Issue 7, IEEE Std 1003.1-2008, Base Definitions volume: Directory Structure and Files: /tmp . . 2011-04-02.
  3. Web site: Filesystem Hierarchy Standard, version is 2.3: /tmp: Temporary files . . 2010-06-13.
  4. Web site: Filesystem Hierarchy Standard, version is 2.3: /var/tmp: Temporary files preserved between system reboots . . 2010-06-13.
  5. Web site: The Open Group Base Specifications Issue 7, IEEE Std 1003.1-2008, Base Definitions volume: Environment Variables: Other Environment Variables: TMPDIR . . 2011-04-02.