This discussion is archived
1 Reply Latest reply: Mar 4, 2013 11:39 AM by Dude! RSS

anomoly in 'find' command

EdStevens Guru
Currently Being Moderated
Oracle LInux 5.6 x86-64

Note the below 'find' command and output:
oracle:+ASM$ find . -user root -exec ls -l {} \;
-rw-r--r-- 1 root root 3625 Feb  3 12:39 ./srvm/admin/logging.properties
-rwsr-x--- 1 root oinstall 1242078 Feb  3 12:35 ./bin/extjob
-rwsr-x--- 1 root oinstall 43752 Feb  3 12:35 ./bin/jssu
-rwsr-x--- 1 root oinstall 68432 Sep  4  2010 ./bin/oradism
-rw-r--r-- 1 root root 8445 Feb  3 12:39 ./bin/oradaemonagent
-rw-r--r-- 1 root root 2378 Feb  3 12:39 ./evm/admin/conf/evmdaemon.conf
-rw-r--r-- 1 root root 3041 Feb  3 12:39 ./evm/admin/conf/evm.auth
-rw-r--r-- 1 root root 4955 Feb  3 12:39 ./evm/admin/conf/evmlogger.conf
-rwxr-xr-x 1 root root 13522 Feb  3 12:37 ./crs/install/roothas.pl.orig
-rwxr-x--- 1 root oinstall 399 Feb  3 12:39 ./crs/install/s_crsconfig_itdwprod_env.txt
total 340
-rw-r--r-- 1 root root   605 Feb  3 12:39 appvipcfg
-rw-r--r-- 1 root root  1802 Feb  3 12:39 clsrwrap
-rw-r--r-- 1 root root  4031 Feb  3 12:39 cluutil
-rw-r--r-- 1 root root  1293 Feb  3 12:39 cmdllroot.sh
-rw-r--r-- 1 root root 15167 Feb  3 12:39 crfcheck
-rw-r--r-- 1 root root   712 Feb  3 12:39 crfsetenv
-rw-r--r-- 1 root root 10065 Feb  3 12:39 crsconfig_dirs
Question is why is it reporting a bunch of files (I've truncated the list for brevity) with no relative direcotry? Further investigation revealed that there are actually two of each of those files, in different directories. I don't understand why 'find' didn't report as such.
  • 1. Re: anomoly in 'find' command
    Dude! Guru
    Currently Being Moderated
    Perhaps the following gives you the results you are looking for:
    find -user root -ls
    I think the problem you are experiencing is due to the hidden . and .. directories, which are also owned by root. For example:
    ls -l .
    ... will show you the files of the current directory and hence parsing the found objects using the -exec ls {} command will produce the duplicated result you are seeing.

    You might be able to use your command by adding "-type f", but I think using "-ls" is more efficient.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points