Link to home
Start Free TrialLog in
Avatar of MaritimeSource
MaritimeSource

asked on

'find' linux command - filter out directories

I'm running this command:
find . > tmp.txt

but it also includes the directory names it finds along the way. Is there a way to filter out the directories?

Thanks
Avatar of Autogard
Autogard

There is a "type" option in find...

=== From the man page for find ===

-type c
              File is of type c:
              b      block (buffered) special
              c      character (unbuffered) special
              d      directory
              p      named pipe (FIFO)
              f      regular file
              l      symbolic link (never true if the -L option or the -follow option is in effect, unless the symbolic link is broken).
              s      socket
              D      door (Solaris)
==============================

So try "find -type f > tmp.txt" (or something similar).
ASKER CERTIFIED SOLUTION
Avatar of Autogard
Autogard

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
try with locate tmp.txt
Autogard's comment is the answer to the question, locate is (horrible) unreliable.
locate is faster than find though
<off-topic>
doesn't matter how fast imagination is, I'll wait for the truth ;-)
</off-topic>