LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   find command max depth (https://www.linuxquestions.org/questions/linux-newbie-8/find-command-max-depth-4175496033/)

elalexluna83 02-24-2014 09:52 AM

find command max depth
 
Hi Guys, i am not clear with the find command, i need to find the newest files under /, but only / not the other filesystem.

Here's a example of my Filesystems

localhost.localdomain:/# df -m
Filesystem MB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 1664.00 56.60 97% 12693 30% /
/dev/hd2 6368.00 1283.02 80% 85210 21% /usr
/dev/hd9var 1248.00 756.68 40% 8181 5% /var
/dev/hd3 544.00 524.18 4% 65 1% /tmp
/dev/hd1 1024.00 899.94 13% 543 1% /home
/proc - - - - - /proc
/dev/hd10opt 2304.00 1077.08 54% 28317 11% /opt
/dev/livedump 256.00 255.64 1% 4 1% /var/adm/ras/livedump
/dev/fslv00 384.00 321.93 17% 343 1% /root
/dev/db2v9_lv 5120.00 2316.56 55% 16739 3% /opt/IBM/db2


i'd like to find files only under "/" not /usr /var /tmp or any other filesystem.

any idea?

schneidz 02-24-2014 10:05 AM

man find (-maxdepth 1 -newer)

Mr. Alex 02-24-2014 10:27 AM

"cd" into any directory you wanna search within and do

Code:

find . -maxdepth 1 -type f -printf "%C@ %p\n" | sort -rn | head

michaelk 02-24-2014 10:32 AM

As far as I know maxdepth 1 will still search 1 level below / including all /home /tmp etc but not the entire / partition. This is not what the OP is asking. The prune option will exclude directories.

Here are some examples:
http://www.theunixschool.com/2012/07...o-exclude.html

Mr. Alex 02-24-2014 10:36 AM

This also might help.

linosaurusroot 02-24-2014 11:04 AM

-xdev


All times are GMT -5. The time now is 09:34 AM.