Changing temporary file folder location in linux (for everything on the system)?
Solution 1
sudo rmdir /tmp && ln -s /some/other/loc /tmp
Alternatively, set the environment variable TMPDIR
at the highest level possible. For the environment, or per user.
Solution 2
Specific applications may have configuration options or environment variables for this, but in general *nix systems are supposed to use /tmp
for temporary files, and this cannot be changed.
Solution 3
You can, if you really insist, make /tmp
be a symbolic link to whatever location you want (Matt Joiner's answer gives the specific command to do that).
For example, on Mac OS, /tmp
is a symlink to /private/tmp
. This arrangement can be used to facilitate the ability to NFS-mount /
(presumably read-only) while keeping system-specific files that can't be shared (/etc, /tmp, and so forth) in a /private
partition on a local disk.
siliconpi
Updated on August 31, 2022Comments
-
siliconpi over 1 year
Currently its /tmp
How can I set it to /anythingelse so that all applications use that subsequently?
-
Mark Embling over 13 yearsWhy would you want to do this?
-
-
Ignacio Vazquez-Abrams over 13 yearsThis does not change it from
/tmp
. This merely changes where/tmp
points. -
Matt Joiner over 13 yearsThe clue is in "all applications subsequently". It doesn't get sweeter.
-
Matt Joiner over 10 yearsChanging
TMPDIR
, does change it from/tmp
. -
CodeBy almost 3 yearsafter doing that some apps didn't run: "cannot create temporary directory for the root file system: Permission denied"
-
Matt Joiner almost 3 yearsYou will probably need to create the directory in advance, and give everyone permissions.