SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Yes, you can remove everything in /tmp. A (the?) proper way to do this is to login as root, then to switch to single user mode with the init 1 command and to use the following commands to create a sane /tmp hierarchy :
Personally, I avoid the issue altogether and run a 'tmpfs', i.e: a ramdisk which is mounted under /tmp at bootup. Don't have to worry about deleting stuff this way - it goes away when I shutdown the computer.
Refer to /path/to/kernel/source/Documentation/filesystems/tmpfs.txt for more info.
The change to 'tmpfs' will only be permanent if you want it to be. Try it. If it degrades your system performance, switch back. Simple.
In ~ 4 years (or however long its been since tmpfs came out) I've not experienced the problems discussed in the IBM article. But then I like to load my mobos with all the RAM they can carry.
That's not a bad idea with tmpfs... I just append to the startup script. When it cleans /var/lock, I have it wipe /tmp as well. Those required sockets seem to get created automatically.
#!/bin/bash
# /usr/local/sbin/deleteoldfiles
# delete old tmp files
echo "Deleting old tmp files."
TMPDIRS="/tmp /var/tmp" # list of directories to clean
for d in $TMPDIRS; do
find $d ! -type d -mtime +10 -exec rm -f {} \;
find $d -type d -mtime +10 -exec rmdir {} \;
done
#!/bin/bash
# /usr/local/sbin/cleanup
# delete various tmp files
echo "Deleting various tmp files."
# first delete known single files
rm -f /tmp/.ICE-unix/* /tmp/kio*
# next delete files recursively
rm -rf /tmp/kde-root/* /tmp/kde-username/* /tmp/kde-tester/* /tmp/.wine*
The above would find all regular files not accessed in three days and remove them. It's better than shutdown/startup script solution since it will also work if you keep your box powered up.
I like that even better... I've gotten in the habit of never using /tmp to store stuff, but you never know. You could build a new mozilla package and then forget to remove it before a reboot. Then you'd have to spend another hour building the package...
jong357: I like that even better... I've gotten in the habit of never using /tmp to store stuff, but you never know. You could build a new mozilla package and then forget to remove it before a reboot. Then you'd have to spend another hour building the package...
The traditional pratice is to assume that temporary files in /tmp/ are removed between system reboots, whereas temporary files in /var/tmp/ are not . So, if you want to keep temporary files between reboots, you would probably store them in /var/tmp/. By default, Slackware Linux does not remove temporary files in /tmp/ between reboots, however many Unix/Linux systems remove them (or store them in a temporary filesystem such as tmpfs). Note that you can ignore this traditional pratice on your system until Slackware Linux uses tmpfs for /tmp/ by default, but this is something to know to avoid problems on others systems.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.