Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 06-28-2012, 12:32 PM   #1
Registered: Mar 2009
Posts: 51

Rep: Reputation: 1
command to find and remove all files from /tmp direct that are older than 5 days old

I tried this

does it look correct?

find . -mtime +5 -exec rm {} /tmp/\;
Old 06-28-2012, 12:50 PM   #2
Registered: Jun 2012
Location: Canada
Distribution: Ubuntu/Debian/CentOS
Posts: 45

Rep: Reputation: 19
Try this:

find /tmp/* -mtime +5 -exec rm {} \;
Source: HowToGeek

Last edited by montel; 06-28-2012 at 12:51 PM. Reason: source
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Bash script to remove files older than 3 days rust8y Linux - General 26 10-04-2012 09:26 AM
Bash script to remove files older than x days henkoslaw Linux - General 1 06-10-2012 04:55 AM
[SOLVED] Script: find, compress, remove original files, older than x days? blacklion Linux - General 5 02-27-2012 11:22 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:34 AM.

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