I created a normal user in linux, then created a emptyfile in /tmp directory. delted user
and using find command, locate it. then I found this.
Code:
root@garlicbread:[/]# find tmp -nouser -o -nogroup
tmp/ownedbytest
root@garlicbread:[/]# find tmp -nouser -o -nogroup -print
root@garlicbread:[/]# find tmp -nouser -o -nogroup -exec ls -l '{}' \;
root@garlicbread:[/]#
as you can see if I use -print or -exec option, find does not locate the target file
Code:
root@garlicbread:[/]# find tmp -nouser -o -nogroup | xargs ls -l
-rw------- 1 1001 users 0 10월 2 10:44 tmp/ownedbytest
I can use xargs to list as long option, but I noticed that if find does not find any file it execute with empty arguments thus listing current directory.
Code:
root@garlicbread:[/]# find tmp -nogroup | xargs ls -l
total 97
drwxr-xr-x 2 root root 4096 Sep 28 06:54 bin
drwxr-xr-x 4 root root 1024 Sep 28 06:28 boot
drwxr-xr-x 17 root root 5940 Oct 1 07:51 dev
drwxr-xr-x 101 root root 12288 Oct 2 10:45 etc
drwxr-xr-x 5 root root 4096 Oct 2 10:45 home
drwxr-xr-x 7 root root 4096 Aug 20 03:02 lib
drwxr-xr-x 2 root root 12288 Sep 28 08:22 lib64
...
Does anyone know why find does not execute as expected?
I'm using slackware64 14.1