We help IT Professionals succeed at work.

temp file linux

hi how can i configure the temp folder
i what my  /usr1, /usr2, /usr3 path to poin to /temp with 10gib

Filesystem                 Size  Used Avail Use% Mounted on
devtmpfs                   3.8G     0  3.8G   0% /dev
tmpfs                      3.8G     0  3.8G   0% /dev/shm
tmpfs                      3.8G  8.9M  3.8G   1% /run
tmpfs                      3.8G     0  3.8G   0% /sys/fs/cgroup
/dev/mapper/app_zone-root   10G  4.6G  5.5G  46% /
/dev/mapper/app_zone-temp   10G   33M   10G   1% /temp
/dev/mapper/app_zone-usr2   30G   33M   30G   1% /usr2
/dev/mapper/app_zone-usr3   30G   33M   30G   1% /usr3
/dev/mapper/app_zone-usr1  120G   33M  120G   1% /usr1
/dev/mapper/app_zone-var    10G  2.7G  7.4G  27% /var
/dev/mapper/app_zone-home   10G   47M   10G   1% /home
/dev/sda2                   10G  219M  9.8G   3% /boot
tmpfs                      773M   16K  773M   1% /run/user/1000
/dev/sr0                    82M   82M     0 100% /run/media/calapp/VBox_GAs_6.0.
Comment
Watch Question

Software Engineer
Distinguished Expert 2019
Commented:
Export 2 variables from your shell
export TEMP=/temp
export TMPDIR=/temp

Open in new window

(can be in the systemwide /etc/profile.d/settempdir.sh directory with some scripting).
Most software should honour those variables.

Ensure the /temp has the right protectionsettings....

chmod ogu+rwxt /temp

Open in new window

David FavorFractional CTO
Distinguished Expert 2019

Commented:
Slightly expanding noci's solution.

Just be sure to set $TEMP + $TMPDIR globally somewhere, like /etc/environment or however your Distro manages global environment variables.

Remember, likely a reboot will be required for /etc/environment to be read by every running process.
murugesandinsWe like KT across the universe.  Shell_script Automation /bin/bash /bin/bash.exe /bin/ksh /bin/mksh.exe AIX C C++ CYGWIN_NT HP-UX Linux MINGW32 MINGW64 SunOS Windows_NT

Commented:
based on comment from noci
export TEMP=/temp
export TMPDIR=/temp

Open in new window

write above statements in
~/.bashrc
or ~/.bash_profile file for making them permanent for required users.
>> Comment from David Facor
use /etc/environment file if required to set for all users. => require root or sudo access
David FavorFractional CTO
Distinguished Expert 2019

Commented:
Whether you use ~/.* files or environment files + how exactly you approach all this depends on...

1) Do you require these variables being set only for interactive shells.

2) Do you require these variables being set for all shells (including background/batch/CRON) initiated shells.

Really best to start by answering these 2x questions, choosing a solution matching your answer.