Solved

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

Posted on 1998-05-26
6
248 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Remote Change Dates on AIX Automation 7 50
Unix Command -- Challenging  question 7 86
Problem logging tar errors 11 54
Access_log 17 95
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…
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
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…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

947 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

21 Experts available now in Live!

Get 1:1 Help Now