LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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, 09:52 AM   #1
elalexluna83
Member
 
Registered: Mar 2012
Posts: 55

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, 10:05 AM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

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

Last edited by schneidz; 02-24-2014 at 10:31 AM.
 
Old 02-24-2014, 10: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 10:31 AM.
 
Old 02-24-2014, 10:32 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,670

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
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 10:34 AM.
 
Old 02-24-2014, 10: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, 11:04 AM   #6
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
-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 05:54 PM
how to find max memory usage for process in Linux by command line kashameni Linux - Newbie 9 06-01-2007 01:39 AM
mkisofs/max directory depth otoomet Linux - Software 0 12-21-2004 12:19 PM
When referencing a command, how far in depth can the symbolic link be followed? davidas Debian 2 04-12-2004 06:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:35 PM.

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
Open Source Consulting | Domain Registration