?
Solved

Why -newer option doesn't work in find command?

Posted on 1998-05-26
6
Medium Priority
?
282 Views
Last Modified: 2010-04-21
I tried to find all the files which were created after a file /tmp/aaa, but it doesn't seem to give me the right answer. Here's what I did ( IRIX6.2):
1. ls -l /tmp/aaa
-rw-r--r--    1 root     sys            7 May 18 07:00 /tmp/aaa
2. stat /tmp/aaa
/tmp/aaa:
        inode 2099346; dev 33554704; links 1; size 7
        regular; mode is rw-r--r--; uid 0 (root); gid 0 (sys)
        st_fstype: xfs
        change time - Tue May 26 11:29:39 1998 <896200179>
        access time - Mon May 18 07:00:00 1998 <895492800>
        modify time - Mon May 18 07:00:00 1998 <895492800>

3. find / -local -newer /tmp/aaa -exec ls -l {} \;
drwxr-xr-x    2 root     sys            9 Feb 20  1997 CDROM
lrwxr-xr-x    1 root     sys            4 Feb 20  1997 debug -> proc
drwxr-xr-x   18 root     sys        12288 May 14 15:28 dev
drwxr-xr-x   19 root     sys        12288 May 18 15:20 etc
dr-xr-xr-x    1 root     sys          512 May 14 15:24 home
drwxr-xr-x    2 root     bin           43 May  8 08:10 krb5
drwxr-xr-x    2 root     sys           72 Nov 11  1997 lib
drwxr-xr-x    2 root     sys           39 Nov 11  1997 lib32
drwxr-xr-x    2 root     sys           21 Aug 25  1997 lib64
drwxr-xr-x    2 root     sys            9 Jan 29 06:28 mnt


Look at those dates! Those I expected should be later than May 18, right?
Please explain to me. Thanks.
Emay
0
Comment
Question by:Emay
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 2007242
perhaps / itself is newer than /tmp/aaa?
try
 find / -local -newer /tmp/aaa -exec ls -ld {} \;
or
 find / -local \! -type d -newer /tmp/aaa -exec ls -ld {} \;

0
 

Author Comment

by:Emay
ID: 2007243
It worked! Thanks a lot!!
But I am not quit get it though. How come ls -ld worked but ls -l did not?
Thank you very much
Emay
0
 
LVL 84

Expert Comment

by:ozo
ID: 2007244
You could use something like
 find / -local \! -type d -newer /tmp/aaa -exec ls -l {} \;
(but then you don't get to see if / is newer than /tmp/aaa)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Emay
ID: 2007245
Thank you very much for your help
Emay
0
 
LVL 84

Accepted Solution

by:
ozo earned 200 total points
ID: 2007246
find / -local -newer /tmp/aaa -exec ls -ld {} \;
find / -local \! -type d -newer /tmp/aaa -exec ls -l {} \;
0
 
LVL 84

Expert Comment

by:ozo
ID: 2007247
Emay, was there anything else you needed?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question