LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 02-27-2016, 12:30 AM   #1
arun natarajan
Member
 
Registered: Jun 2014
Posts: 108

Rep: Reputation: Disabled
find


hi,

For below scenario, is the cmd correct ?

Find all the files in the system bigger than 100KB in size and not accessed in the last 1 year

# find / -size +100k -atime +365 -exec ls -ltrh {} \;

Last edited by arun natarajan; 02-27-2016 at 01:01 AM.
 
Old 02-27-2016, 12:49 AM   #2
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,665

Rep: Reputation: 486Reputation: 486Reputation: 486Reputation: 486Reputation: 486
Quote:
Originally Posted by arun natarajan View Post
hi,

For below scenario, is the cmd correct ?

Find all the files in the system bigger than 100KB in size and not accessed in the last 1 year

# find / -size +100k -atime +365 -exec {} \;
The -exec command needs argument; if you want to view immediately what is found you may specify it by exec, this way:
Code:
find / -size +100k -atime +365 -exec ls -l {} \;
Try it. Hope that helps. Good luck.
 
1 members found this post helpful.
Old 02-27-2016, 09:50 AM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,546

Rep: Reputation: 1558Reputation: 1558Reputation: 1558Reputation: 1558Reputation: 1558Reputation: 1558Reputation: 1558Reputation: 1558Reputation: 1558Reputation: 1558Reputation: 1558
Note that atime is not very useful in today's systems. First, the filesystem would have to be mounted with the "strictatime" option, but a common default is "relatime", which does not update atime if it is already newer than mtime. Second, any GUI file manager is going to read the beginning of every file in a directory in order to determine its type and choose an icon, so the atime for those files is just going to show you the last time someone opened that directory in a file manager. Third, backup tools have to get very clever to avoid disturbing atime when backing up a file. Some try to restore the original atime after reading the file, but doing that causes a ctime update, which is even worse.
 
1 members found this post helpful.
Old 02-27-2016, 02:18 PM   #4
MadeInGermany
Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 468

Rep: Reputation: 204Reputation: 204Reputation: 204
Still, atime indicates dead bodies, that are not even read by a file manager.
atime for anything but a file is pointless, so ensure files with
Code:
find ... -type f ...
 
1 members found this post helpful.
  


Reply


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
Old School -- gdbmtool & dbmutil -- can't find RPMs and can't find Source spudzy Linux - Software 3 09-27-2014 06:29 AM
[SOLVED] Bash Issue with Find Script: find paths must precede expression: *.txt JockVSJock Programming 4 01-06-2014 09:03 PM
[SOLVED] Find URL in Debian package index via awk/sed (=find a line, then search from there) maddes.b Linux - Software 11 06-28-2013 07:37 AM
Find with -exec argument - not giving proper output..how to find... hinetvenkat Linux - Server 4 01-25-2010 06:19 AM
Find/grep/wc command to find matching files, print filename and word count dbasch Linux - Newbie 10 09-14-2009 05:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:59 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration