Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
| 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
02-16-2009, 09:43 AM
|
#1
|
|
Member
Registered: Jan 2009
Distribution: slackware 12.1 (kernel 2.6.24.5-smp)
Posts: 39
Rep:
|
cannot remove contents of the /tmp folder
Hello,
Im trying to delete the contents of my /tmp folder, so from within /tmp I issue this command:
but it gives me the error message:
Ive tried the above command as root also.
The permissions on the /tmp folder are 'drwxrwxrwt', Im wondering what the 't' is ?
Is there a special command to delete the contents of the /tmp folder?
|
|
|
|
02-16-2009, 10:01 AM
|
#2
|
|
Member
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412
Rep:
|
You can try the following but you should be careful as it will probably delete files that are in use:
The '--' mans there are no more parameters.
Use at your own risk.
|
|
|
|
02-16-2009, 03:59 PM
|
#3
|
|
LQ Newbie
Registered: Feb 2009
Location: St Paul, Minnesota, USA
Distribution: Redhat Fedora 10; someday planet CCRMA
Posts: 11
Rep:
|
deleting files that are in use
This is legal in unix, I'm pretty sure. a "rm" command will succeed but the file will stick around UNTIL IT IS NO LONGER OPEN. THEN it will be really removed.
|
|
|
|
02-17-2009, 07:12 AM
|
#4
|
|
LQ Newbie
Registered: Dec 2008
Posts: 12
Rep:
|
't' is denoted for sticky bit. You cannot delete files which are not owned by you if sticky bit is applied on a directory.
|
|
|
|
02-17-2009, 07:51 AM
|
#5
|
|
Member
Registered: Oct 2008
Location: Fife
Distribution: RHEL, Centos
Posts: 373
Rep:
|
You can remove the stiky bit as root:
chmod -t /tmp
if /tmp is owned by root, then he shopuld be able to remove the files anyway
|
|
|
|
02-17-2009, 09:00 AM
|
#6
|
|
Member
Registered: Apr 2008
Location: UK
Distribution: Mepis; Maemo; openSUSE
Posts: 384
Rep:
|
Just do a reboot. That should clear out /tmp. It seems to have done on my system. My last reboot was 8 Feb and there are no files older than that in /tmp.
|
|
|
|
02-17-2009, 10:06 AM
|
#7
|
|
Senior Member
Registered: Dec 2008
Location: Gorizia, Italy
Distribution: Debian Testing Amd64
Posts: 3,126
Rep: 
|
Yes, Rich_c is right. Just wait for your next reboot and /tmp gets cleared out automatically. I don't think it's a clever idea to remove everything from /tmp on a running system. Lots of apps put stuff there until they are closed down. Removing these /tmp file would probably bring your system down. You can certainly delete specific files that you know are no longer necessary (I use /tmp as my default download folder and delete installation files all the time). Why do you want to delete everything from /tmp anyway?
cheers,
jdk
|
|
|
|
02-17-2009, 02:32 PM
|
#8
|
|
Member
Registered: Jan 2009
Distribution: slackware 12.1 (kernel 2.6.24.5-smp)
Posts: 39
Original Poster
Rep:
|
Thanks everyone.
Rebooting didnt remove the files in /tmp (slackware 12.1), but doing:
as suggested did remove all the files, and it doesnt seem to have created any problems (at least not yet!)
p.s jdkaye, I just wanted a clearout 
|
|
|
|
02-17-2009, 02:40 PM
|
#9
|
|
Member
Registered: Oct 2008
Location: Upstate NY
Distribution: Arch Linux
Posts: 99
Rep:
|
Don't remove the /tmp sticky bit evar. It's for security 
|
|
|
|
02-17-2009, 11:30 PM
|
#10
|
|
Senior Member
Registered: Dec 2008
Location: Gorizia, Italy
Distribution: Debian Testing Amd64
Posts: 3,126
Rep: 
|
Quote:
Originally Posted by bergman
Thanks everyone.
Rebooting didnt remove the files in /tmp (slackware 12.1), but doing:
as suggested did remove all the files, and it doesnt seem to have created any problems (at least not yet!)
p.s jdkaye, I just wanted a clearout 
|
bergman,
There are always going to be files in /tmp for the reasons explained above. Are you sure the ones that you save in /tmp when you rebooted arent' fresh ones installed after your latest reboot? You can check the date/time of the files by doing
cheers,
jdk
|
|
|
|
02-18-2009, 02:17 AM
|
#11
|
|
Member
Registered: Jan 2009
Distribution: slackware 12.1 (kernel 2.6.24.5-smp)
Posts: 39
Original Poster
Rep:
|
There are a few hidden files and directories which seem to have been created since the reboot (.xorg.conf, .X0-lock, etc), but alot fewer than there were.
I suppose Im trying to clean up a directory which by its nature is 'untidy'.
Last edited by bergman; 02-18-2009 at 02:18 AM.
|
|
|
|
02-18-2009, 03:25 AM
|
#12
|
|
Member
Registered: Apr 2008
Location: UK
Distribution: Mepis; Maemo; openSUSE
Posts: 384
Rep:
|
Quote:
Originally Posted by bergman
I suppose Im trying to clean up a directory which by its nature is 'untidy'.
|
And probably best left ignored, unless it's using an awful lot of space. Mine's got 5.2MB in the 10 days since last reboot.
|
|
|
|
02-18-2009, 09:17 AM
|
#13
|
|
LQ Newbie
Registered: Feb 2009
Location: Spain
Distribution: CentOS 5.2
Posts: 13
Rep:
|
A useful command for know if some process is using any file inside /tmp folder do the following:
The output will be the PID of the processes using files under /tmp
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:53 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|