Go Back   TechArena Community > Software > Operating Systems
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 26-02-2012
Member
 
Join Date: Feb 2012
Posts: 89
Command Line in Linux to clear the /tmp folder

I am not a regular Linux user. I was working on Linux when I realized that my system is working slowly. I asked my friend about it and h suggested me to clear the /tmp folder. Can anyone help me to clear /tmp folder and also provide some hints to reduce this problem in future?
Reply With Quote
  #2  
Old 26-02-2012
Member
 
Join Date: Jul 2011
Posts: 319
Re: Command Line in Linux to clear the /tmp folder

Firstly, the /tmp folder should not placed along with the folder and files tha you use frequently or some other application uses frequently. Files which are necessary for an Apache session, .pid files & .lock files should never come near to the /tmp folder. I suggest they should be placed in other drive. The writable files create by applications should also not be saved near the /tmp folder.
Reply With Quote
  #3  
Old 26-02-2012
Member
 
Join Date: Mar 2011
Posts: 489
Re: Command Line in Linux to clear the /tmp folder

Usually many versions of Linux are pre-programmed to clean the /tmp folder on reboot. This is because they save /tmp files on RAM disk. If any app is automatically saving important data in that folder, change the output location. I suggest you simple solution of loading a module in startup execution. Here is the code for module,
mkdir -f /tmp/directory
chown .... # if needed
chmod .... # if needed
.
.
"Normal startup"
Reply With Quote
  #4  
Old 26-02-2012
Member
 
Join Date: May 2008
Posts: 246
Re: Command Line in Linux to clear the /tmp folder

While removing a file from /tmp folder, see to the ownership of the file. If the ownership of file doesn?t belong to your system then the file won?t delete. If you try to delete it with force or maybe by using 3rd party application, it might harm your system. Never remove the /tmp folder, it is necessary for proper operation of system.
Reply With Quote
  #5  
Old 26-02-2012
Member
 
Join Date: Aug 2011
Posts: 416
Re: Command Line in Linux to clear the /tmp folder

Try ?rm? command. If you will be using this command as a root user you have to be extremely careful. Many users have faced problems after unknowingly deleting important core files and data while using ?rm? command. If you want to delete the contents of /tmp folder periodically, then you can add the following code to your shellscript in combination of ?rm? command.
tmpwatch --mtime --all 240 /tmp
Here , 240 = 24 x 10 where 10 is number of days.
This code will clear the /tmp folder every 10 days.
Reply With Quote
Reply

  TechArena Community > Software > Operating Systems
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Command Line in Linux to clear the /tmp folder"
Thread Thread Starter Forum Replies Last Post
How to perform Cut and paste from command line in Linux Malik B Operating Systems 4 11-11-2010 04:12 PM
Clear the history command in Linux Dumpkin Operating Systems 3 10-11-2010 10:33 PM
Deleting line with sed command in unix/linux Fragman Software Development 5 20-03-2010 09:47 PM
Inroduction of Linux command line Ceesar Operating Systems 5 31-12-2009 02:20 AM
How to send email from the Linux command line roumieh2000 Windows Software 4 15-09-2009 06:38 PM


All times are GMT +5.5. The time now is 08:00 PM.