LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-23-2013, 09:33 PM   #1
dsotm
Member
 
Registered: Mar 2012
Distribution: Slackware64-current, Fedora 33
Posts: 90

Rep: Reputation: 2
Is it safe to delete everything from /tmp


Have a sizeable amount growing (including a bunch from /tmp/SBo), safe to delete it?
 
Old 04-23-2013, 09:45 PM   #2
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 4,670

Rep: Reputation: 1786Reputation: 1786Reputation: 1786Reputation: 1786Reputation: 1786Reputation: 1786Reputation: 1786Reputation: 1786Reputation: 1786Reputation: 1786Reputation: 1786
Yes, it's safe to delete them
it will be re-created when you decided to build another package from SBo
 
Old 04-24-2013, 12:20 AM   #3
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
You could backup the created packages just to be safe to create your own repository so you dont have to rebuild them in case of a reformat or a package getting overwritten accidentally.
 
Old 04-24-2013, 12:49 AM   #4
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,557

Rep: Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762
There are three solutions to automatically clear it down here:

http://docs.slackware.com/howtos:gen...ree_your_space

Last edited by ruario; 04-24-2013 at 12:50 AM. Reason: changed couple to three
 
Old 04-24-2013, 01:12 AM   #5
Beelzebud
Member
 
Registered: Oct 2010
Distribution: Arch & Slackware
Posts: 96

Rep: Reputation: 29
Be careful deleting everything from /tmp. Sometimes there are things in there you don't want to remove, especially on a completely default setup. Here is how I dealt with it, in a safe fashion:

Create /etc/rc.d/rc.local_shutdown

Code:
#! /bin/sh
# Clear /tmp directory of older files (>10 days since accessed)
find /tmp -type f -atime +10 -exec rm {} \;
echo rc.6: Deleting /tmp files not accessed in 10 days.;
save the file and run chmod +x on it

This will only delete files that haven't been accessed in 10 days.
 
Old 04-24-2013, 03:12 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,930

Rep: Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321
yes, there can be some files currently in use...
 
Old 04-24-2013, 04:05 AM   #7
ottavio
Member
 
Registered: Nov 2007
Posts: 312

Rep: Reputation: 46
Quote:
Originally Posted by pan64 View Post
yes, there can be some files currently in use...
If they are in use you won't be able to delete them.

Better to add a line in rc.local.
 
Old 04-24-2013, 04:11 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,930

Rep: Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321
Quote:
Originally Posted by ottavio View Post
If they are in use you won't be able to delete them.
No, it is not true. for example during a compilation (or any other complex processes) there can be work files stored in /tmp. Different phases of that process can read or write those files and you are allowed to delete them - and therefore fool your process.
 
Old 04-24-2013, 05:53 AM   #9
ChrisAbela
Member
 
Registered: Mar 2008
Location: Malta
Distribution: Slackware
Posts: 572

Rep: Reputation: 154Reputation: 154
The reply to your question is "It depends ..."

In my case, I export OUTPUT to a repository in the /home directory to keep all the packages I build. I noticed that unless there at least one logged-in user, the /tmp directory is not used, so in /etc/rc.d/rc.local I entered the following

cd /tmp
find . -exec rm -rf {} \; 2> /dev/null
 
Old 04-24-2013, 06:17 AM   #10
wildwizard
Member
 
Registered: Apr 2009
Location: Oz
Distribution: slackware64-14.0
Posts: 875

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
Originally Posted by pan64 View Post
No, it is not true. for example during a compilation (or any other complex processes) there can be work files stored in /tmp. Different phases of that process can read or write those files and you are allowed to delete them - and therefore fool your process.
Unless the program closes the file handle the file will never be truly deleted.
 
Old 04-24-2013, 07:14 AM   #11
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,930

Rep: Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321
Quote:
Originally Posted by wildwizard View Post
Unless the program closes the file handle the file will never be truly deleted.
for example gcc is a wrapper and calls a few processes like cpp. Those processes will create files in /tmp (and of course they use the previously generated ones). Yes, you are right the processes will keep the files as long as they exist, but in the next step the removed file will not be available therefore the compiling process will be broken.
The parent process (gcc itself) does not open that file just uses its name and passes it to the child processes.
 
Old 04-24-2013, 12:55 PM   #12
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Code:
cd /usr/src
wget http://helmut.hullen.de/filebox/Linux/slackware/a/tmpwatch-2.9.16-i386-1hln.tgz
installpkg tmpwatch-2.9.16-i386-1hln.tgz
sudo crontab -e
Code:
*/15 * * * * /usr/sbin/tmpwatch --atime 1 /tmp --exclude=/tmp/SBo/ > /dev/null 2>&1
will delete contents of /tmp every 15m on your system but will exclude the /tmp/SBo directory.

I used to have to (re)create the /tmp/SBo directory every time I run # sbopkg
so I use the above in cron to keep /tmp nice and tidy.

It's never hurt anything on my system when I deleted /tmp/SBo
 
Old 04-24-2013, 12:58 PM   #13
arubin
Senior Member
 
Registered: Mar 2004
Location: Middx UK
Distribution: Slackware64 15.0 (multilib)
Posts: 1,350

Rep: Reputation: 75
I have /tmp in RAM so it is deleted every time I turn off my computer.
 
2 members found this post helpful.
Old 04-24-2013, 01:14 PM   #14
digger95
Member
 
Registered: Oct 2007
Location: Indiana, PA
Distribution: Slackware 14
Posts: 330

Rep: Reputation: 46
This has been a very useful thread to me so thanks to everyone.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I delete files in /mnt/tmp? and Files in the trash can will not delete? M$ISBS Slackware 15 10-02-2009 11:56 PM
Is it safe to delete stuff in /tmp? (SUSE 10.2) digicutkid Linux - Desktop 3 06-11-2007 12:52 AM
Is it safe to delete the contents of /tmp? tramni1980 Slackware 19 01-15-2007 02:39 PM
Is it OK to delete everything in /tmp? forrest44 Slackware 12 11-15-2005 10:47 PM
Delete all in /tmp ??? shreev Slackware 5 08-07-2003 04:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration