I'd like to find all the files suffix with .md
or .org
find ~ -iregex ".*\.md$"
find ~ -iregex ".*\.org$"
How could combine them?
I'd like to find all the files suffix with .md
or .org
find ~ -iregex ".*\.md$"
find ~ -iregex ".*\.org$"
How could combine them?
Just concatenate your search like says in this answer :
Explanation :
-name
would do the search recursively (remove it if you don't want to have subdirectories result)-o
option represents an OR operator (it would execute both commands even if there is no.md
file)~
is the path where you want to start thefind
execution; here, you begins at~
(so/home/user
whereuser
is your username)P.S : if you want to use
()
, you need to use the escape character\
like that :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 :You would be able to find files named like README.MD for example, which aren't shown with the
-name
optionLook into the docs of the
regextype
option to see the supported types of regular expressions. Theegrep
,posix-extended
and maybe others understand the groups/alternatives in parentheses.