Results 1 to 5 of 5

Thread: Command Line in Linux to clear the /tmp folder

  1. #1
    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?

  2. #2
    Join Date
    Jul 2011
    Posts
    322

    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.

  3. #3
    Join Date
    Mar 2011
    Posts
    490

    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"

  4. #4
    Join Date
    May 2008
    Posts
    250

    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.

  5. #5
    Join Date
    Aug 2011
    Posts
    418

    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.

Similar Threads

  1. How to perform Cut and paste from command line in Linux
    By Malik B in forum Operating Systems
    Replies: 4
    Last Post: 11-11-2010, 04:12 PM
  2. Clear the history command in Linux
    By Dumpkin in forum Operating Systems
    Replies: 3
    Last Post: 10-11-2010, 10:33 PM
  3. Deleting line with sed command in unix/linux
    By Fragman in forum Software Development
    Replies: 5
    Last Post: 20-03-2010, 09:47 PM
  4. Inroduction of Linux command line
    By Ceesar in forum Operating Systems
    Replies: 5
    Last Post: 31-12-2009, 02:20 AM
  5. How to send email from the Linux command line
    By roumieh2000 in forum Windows Software
    Replies: 4
    Last Post: 15-09-2009, 06:38 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,749,949,918.07060 seconds with 16 queries