LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-24-2014, 10:52 AM   #1
elalexluna83
Member
 
Registered: Mar 2012
Posts: 53

Rep: Reputation: Disabled
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?
 
Old 02-24-2014, 11:05 AM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,027

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
man find (-maxdepth 1 -newer)

Last edited by schneidz; 02-24-2014 at 11:31 AM.
 
Old 02-24-2014, 11:27 AM   #3
Mr. Alex
Senior Member
 
Registered: May 2010
Distribution: No more Linux. Done with it.
Posts: 1,238

Rep: Reputation: Disabled
"cd" into any directory you wanna search within and do

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

Last edited by Mr. Alex; 02-24-2014 at 11:31 AM.
 
Old 02-24-2014, 11:32 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,938

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
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

Last edited by michaelk; 02-24-2014 at 11:34 AM.
 
Old 02-24-2014, 11:36 AM   #5
Mr. Alex
Senior Member
 
Registered: May 2010
Distribution: No more Linux. Done with it.
Posts: 1,238

Rep: Reputation: Disabled
This also might help.
 
Old 02-24-2014, 12:04 PM   #6
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 979
Blog Entries: 2

Rep: Reputation: 235Reputation: 235Reputation: 235
-xdev
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to execute -depth in find command shravee Linux - Newbie 8 04-23-2010 06:54 PM
how to find max memory usage for process in Linux by command line kashameni Linux - Newbie 9 06-01-2007 02:39 AM
mkisofs/max directory depth otoomet Linux - Software 0 12-21-2004 01:19 PM
When referencing a command, how far in depth can the symbolic link be followed? davidas Debian 2 04-12-2004 07:09 AM


All times are GMT -5. The time now is 08:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration