I'd like to find all the files suffix with
find ~ -iregex ".*\.md$" find ~ -iregex ".*\.org$"
How could combine them?
find ~ -regextype egrep -iregex ".*\.(md|org)"
Look into the docs of the
regextype option to see the supported types of regular expressions. The
posix-extended and maybe others understand the groups/alternatives in parentheses.
Just concatenate your search like says in this answer :
find ~ -name "*.md" -o -name "*.org"
-namewould do the search recursively (remove it if you don't want to have subdirectories result)
-ooption represents an OR operator (it would execute both commands even if there is no
~is the path where you want to start the
findexecution; here, you begins at
useris your username)
P.S : if you want to use
(), you need to use the escape character
\ like that :
find ~ \( -name "*.md" -o -name "*.org" \)
Both of these commands works, but the first is enough in this case.
P.P.S : in case that you want to find files that would got these extensions with uppercases, use the
-iname option instead of
-name option, like that :
find ~ -iname "*.md" -o -iname "*.org"
You would be able to find files named like README.MD for example, which aren't shown with the