Last active
August 29, 2015 14:16
-
-
Save mondwan/a78a2a9c643a3228a09e to your computer and use it in GitHub Desktop.
Usage of Bash command find
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find filename with gcc under folder /usr | |
find /usr -name gcc | |
# Find directory based on filename gcc under folder /usr | |
find /usr -type d -name gcc | |
# Find file which modified today under current directory | |
find -type f -mtime 0 | |
# Find file which filesize is zero | |
find -type f -size 0 | |
# Find filename with pattern a.* and echo them out | |
# `{}` | |
# a place holder that will be filled with all the file names that result from the find expression, | |
# and the preceding command will be run on each one individually. | |
find . -name 'a.*' -exec echo {} ';' | |
# For example, | |
# | |
# $> find . -name 'a.*' -exec echo {} ';' | |
# ./a.py | |
# ./a.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment