Solved

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

Posted on 1998-05-26
6
242 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
  • 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

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

Accepted Solution

by:
ozo earned 50 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now