Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 10-05-2010, 05:14 AM   #1
Registered: Aug 2009
Posts: 537

Rep: Reputation: 32
How to find files under the current directory?

Assumed y directory structure looks as follow:

  -- dir1
     -- dir1-1
  -- dir2
     -- dir2-1
        -- dir2-2
And under each sub dir there are some log files ended with .log.

Now I want to list all these log files. How to to that?
Old 10-05-2010, 05:19 AM   #2
Senior Member
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
You can list the tree using

tree dir
ls -R dir
0 members found this post helpful.
Old 10-05-2010, 05:19 AM   #3
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
A rather non-complicated use of the `find` command will do precisely what you want. Something like:
find . -type f -name "*\.log"
Check `find` man page for loads of other options and things you can do with `find`.

1 members found this post helpful.


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
move all files in current directory into a subdirectory in the current directory jakykong Linux - Newbie 8 07-16-2013 11:46 PM
Find files in current directory, not subdirectories SmurfGGM Linux - Newbie 1 10-09-2008 12:14 PM
how to find files in current directory only (not recursively) babu198649 Linux - Newbie 2 12-27-2007 01:30 AM
find lists current directory kaprasanna Linux - General 3 12-17-2007 04:06 AM
find in current directory ramanadyv Linux - Newbie 3 03-28-2006 10:12 PM

All times are GMT -5. The time now is 04:58 PM.

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