LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-25-2003, 08:05 AM   #1
ludwig W
Member
 
Registered: Mar 2003
Posts: 404

Rep: Reputation: 30
a question about /tmp


Hi,
Is it ok to delete everything in the /tmp directory?
My guess is it's like the windows temp folder where you can just delete it's contents.


cheers,
Ludwig
 
Old 04-25-2003, 08:20 AM   #2
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Not always...

If you are running X you don't wanna delete your lock files; also KDE puts some files in there if you are running it that you don't want to delete unless you stop running it (just for that session). If you are about to reboot, I do believe you can, but I'd be weary of doing it. If you are looking for some space saving use:
du -h
And find the biggest "byte thief" and remove it/them.

Cool
 
Old 04-25-2003, 08:23 AM   #3
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
You should just place a command to clean out and remove everything in /tmp in your startup scripts. Or you can usually log out of X and then remove everything safely.
 
Old 04-25-2003, 09:08 AM   #4
ludwig W
Member
 
Registered: Mar 2003
Posts: 404

Original Poster
Rep: Reputation: 30
ok,so if I log out of X, then it's ok to remove the contents of /tmp and delete it...is that right?
 
Old 04-25-2003, 09:12 AM   #5
webtoe
Member
 
Registered: Apr 2001
Location: Cambridge, England
Distribution: Slackware 10, Fedora Core 3, Mac OS X
Posts: 617

Rep: Reputation: 30
I'd be wary of doing while you're logged in at all. You can have a script, either at boot or shutdown, to clear it out but there is really not much point in doing it any other time. Many of the files there are important to running programs (even ones that aren't X programs). However, a running program that has created a lock file should clear it out once its finished. If it doesn't then its a "stale lock" and is usually safe to delete at shutdown or startup.

Why do you want to clear it out anyway?

Alex
 
Old 04-25-2003, 09:19 AM   #6
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Basically you should be ok to remove any contents in /tmp while logged out of X and not running many programs in the background. I personally have done this numerous times but yet my system could differ from yours so don't hold me reliable if something goes wrong.

The safest bet is to setup a script to remove while shutting down or booting up to clear it out like I mentioned the first time.
 
Old 04-25-2003, 09:57 AM   #7
ludwig W
Member
 
Registered: Mar 2003
Posts: 404

Original Poster
Rep: Reputation: 30
Quote:
The safest bet is to setup a script to remove while shutting down or booting up to clear it out like I mentioned the first time.
Hi m8

could you give me some idea on how I might do that?
cheers,
Ludwig
 
Old 04-25-2003, 10:09 AM   #8
webtoe
Member
 
Registered: Apr 2001
Location: Cambridge, England
Distribution: Slackware 10, Fedora Core 3, Mac OS X
Posts: 617

Rep: Reputation: 30
Code:
rm -rf /tmp/*
That in one of your startup scripts should do the job but be very careful with it. And if its in the startup scripts then make sure that its one of the first things to be run before any progs attempt to make use of /tmp

Alex
 
Old 04-25-2003, 10:15 AM   #9
ludwig W
Member
 
Registered: Mar 2003
Posts: 404

Original Poster
Rep: Reputation: 30
hi m8

I'm running RH8, so could I put it in /etc/re.local ?

Also, what does the "-rf"" do and what does the * do?

sorry to be so uninformed,
Ludwig
 
Old 04-25-2003, 10:20 AM   #10
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally posted by ludwig W
hi m8

I'm running RH8, so could I put it in /etc/re.local ?

Also, what does the "-rf"" do and what does the * do?
rm -rf /tmp/*

rm = command remove
r = recursive
f = forces so no prompts to assure you want to delete

/tmp/* is the directory your removing files from, which basically indicating with the * to remove all files, its a wildcard.
 
Old 04-25-2003, 10:22 AM   #11
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Oh and about the rc.local, I wouldn't place that there, that is usually loaded last or towards the end. You'd want to place the command in one of the other startup scripts that run earlier. I'm not familiar with Redhat's startup scripts now but like on my Slack box I would place it somewhere in my rc.M script in which I use to boot into runlevel 3, multiuser mode.
 
Old 04-25-2003, 10:24 AM   #12
webtoe
Member
 
Registered: Apr 2001
Location: Cambridge, England
Distribution: Slackware 10, Fedora Core 3, Mac OS X
Posts: 617

Rep: Reputation: 30
I'm afraid I don't use Red Hat (and neither does TrickyKid last time I was here) but the rc.local is probably not the best one to choose since its the last one to be run. You'd have to check the documentation for red hat (they have a book online which I found by searching www.google.co.uk/linux for init scripts red hat ).

That should get you sorted

Alex

{*dammit someone always posts before me saying exactly what I was going to say *}

Last edited by webtoe; 04-25-2003 at 10:25 AM.
 
Old 04-25-2003, 10:32 AM   #13
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally posted by webtoe
{*dammit someone always posts before me saying exactly what I was going to say *}
I have 4 arms and 20 fingers.. I'm a freak that is bored at work as well..
 
Old 04-25-2003, 10:41 AM   #14
webtoe
Member
 
Registered: Apr 2001
Location: Cambridge, England
Distribution: Slackware 10, Fedora Core 3, Mac OS X
Posts: 617

Rep: Reputation: 30
Quote:
I'm a freak that is bored at work as well.
Yes you told me that all those years ago when we started at this forum and I asked you whether you actually ever did any work (since you always answered posts before I got near them ).

Alex
 
Old 04-25-2003, 11:44 AM   #15
ludwig W
Member
 
Registered: Mar 2003
Posts: 404

Original Poster
Rep: Reputation: 30
Thanks very much for your help and advice ,guys


Ludwig
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/tmp directory question jvk Linux - Newbie 4 10-12-2004 06:40 PM
/TMP Security question InfluxDan Linux - Security 1 04-30-2004 02:57 AM
tmp folder question synaptical Linux - General 8 08-31-2003 03:10 PM
/tmp question BajaNick Linux - General 6 08-03-2003 08:22 PM
Newbie question - /tmp /var/tmp Mr happy Linux - Security 3 01-27-2003 01:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:49 AM.

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