- How do I list all entries under the current directory?
find .
- How do I list all entries under the '/foo/barr' directory?
find /foo/barr
- How do I list all files under the current directory?
find . -type f
- How do I list all files under the '/foo/barr' directory?
find /foo/barr -type f
- How do I list all directories under the current directory?
find . -type d
- How do I list all symlinks under the current directory?
find . -type l
- How do I list all files under the current directory that were modified within the last day?
find . -type f -mtime -1
- How do I list all files under the current directory that were modified within the last 5 days?
find . -type f -mtime -5
- How do I list all files under the current directory that were modified more than 5 days ago?
find . -type f -mtime +5
- How do I list all files under the current directory that start with 'asdf'?
find . -type f -name "asdf*"
- How do I list all files under the current directory that end in '.html'?
find . -type f -name "*.html"
- How do I list all directories under the current directory that start with 'asdf'?
find . -type d -name "asdf*"
- On linux, how do I list all files under the current directory quoted?
find . -type f -printf '"%p"\n'
- On a UNIX without GNU find, how do I list all files under the current directory quoted?
find . -type f | sed -e 's/^/"/;s/$/"/;'
- How do I list all files under the current directory that contain 'ASDF'?
find . -type f | xargs grep -l 'ASDF'
- How do I list all files under the current directory that contain the string 'ASDF' even if the some of the file names have spaces?
find . -type f -printf '"%p"\n' | xargs grep -l 'ASDF'
- How do I list all '.html' files under the current directory that contains 'ASDF'?
find . -type f -name "*.html" | xargs grep -l 'ASDF'
- How do I delete all '.tmp' files under the current directory?
find . -type f -name "*.tmp" | xargs rm
- How do make all files under the current directory world readable?
find . -type f | xargs chmod +r
- How do make all directories under the current directory world searchable?
find . -type d | xargs chmod +x
- How do I list all files that end in '.html' , '.xhtml' or '.txt' under the current directory?
find . -type f \( -name "*.html" -o -name "*.xhtml" -o -name "*.txt" \)
- How do I list all entries that are not symlinks under the current directory?
find . ! -type l
- How do I list all files that do not end in '.html', '.xhtml' and '.txt'?
find . -type f ! \( -name "*.html" -a -name "*.xhtml" -a -name "*.txt" \)
Hitchhikers Guide to Computing
becoming a power user ...
Friday, April 18, 2008
a Find FAQ
Subscribe to:
Posts (Atom)