how to force find to recursively search subdirectories
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I run this command
find -iname *something*
It normally searches in subfolders but if I have a file that matches the criteria in the working directory it only reports it and stops.
I'm thinking to write a function that first searches sub folders in current directory than issue many find commands for each of them but I feel there should be an easier way... Actually I think it should be the default behavior, so maybe I have something wrong in some setup file?
find
add a comment |Â
up vote
0
down vote
favorite
I run this command
find -iname *something*
It normally searches in subfolders but if I have a file that matches the criteria in the working directory it only reports it and stops.
I'm thinking to write a function that first searches sub folders in current directory than issue many find commands for each of them but I feel there should be an easier way... Actually I think it should be the default behavior, so maybe I have something wrong in some setup file?
find
2
do you have it aliased or hidden with a function?alias find
anddeclare -f find
output would clarify the situation
â Jeff Schaller
Aug 26 '16 at 17:51
1
What happens when you add a dot after find -find . -iname something
?
â fd0
Aug 26 '16 at 17:53
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I run this command
find -iname *something*
It normally searches in subfolders but if I have a file that matches the criteria in the working directory it only reports it and stops.
I'm thinking to write a function that first searches sub folders in current directory than issue many find commands for each of them but I feel there should be an easier way... Actually I think it should be the default behavior, so maybe I have something wrong in some setup file?
find
I run this command
find -iname *something*
It normally searches in subfolders but if I have a file that matches the criteria in the working directory it only reports it and stops.
I'm thinking to write a function that first searches sub folders in current directory than issue many find commands for each of them but I feel there should be an easier way... Actually I think it should be the default behavior, so maybe I have something wrong in some setup file?
find
find
edited Aug 26 '16 at 22:28


Gilles
518k12410341563
518k12410341563
asked Aug 26 '16 at 17:48
user186728
1
1
2
do you have it aliased or hidden with a function?alias find
anddeclare -f find
output would clarify the situation
â Jeff Schaller
Aug 26 '16 at 17:51
1
What happens when you add a dot after find -find . -iname something
?
â fd0
Aug 26 '16 at 17:53
add a comment |Â
2
do you have it aliased or hidden with a function?alias find
anddeclare -f find
output would clarify the situation
â Jeff Schaller
Aug 26 '16 at 17:51
1
What happens when you add a dot after find -find . -iname something
?
â fd0
Aug 26 '16 at 17:53
2
2
do you have it aliased or hidden with a function?
alias find
and declare -f find
output would clarify the situationâ Jeff Schaller
Aug 26 '16 at 17:51
do you have it aliased or hidden with a function?
alias find
and declare -f find
output would clarify the situationâ Jeff Schaller
Aug 26 '16 at 17:51
1
1
What happens when you add a dot after find -
find . -iname something
?â fd0
Aug 26 '16 at 17:53
What happens when you add a dot after find -
find . -iname something
?â fd0
Aug 26 '16 at 17:53
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
5
down vote
Does something include a glob that is being interpreted by the shell? That would cause the expanded filename to be passed to the find command.
For example if you run find -iname *.txt
with a file in the current directory called file.txt then the resulting command after shell expansion would be find -iname file.txt
.
To avoid this pitfall you can escape the glob to send the literal string to the find command with find -iname '*.txt'
add a comment |Â
up vote
0
down vote
If the subfolders are behind symbolic links you have to use the -L option. Try
find -L -iname *something*
According to find man pages
If -L is in effect and find discovers a symbolic link to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched.
New contributor
user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
Does something include a glob that is being interpreted by the shell? That would cause the expanded filename to be passed to the find command.
For example if you run find -iname *.txt
with a file in the current directory called file.txt then the resulting command after shell expansion would be find -iname file.txt
.
To avoid this pitfall you can escape the glob to send the literal string to the find command with find -iname '*.txt'
add a comment |Â
up vote
5
down vote
Does something include a glob that is being interpreted by the shell? That would cause the expanded filename to be passed to the find command.
For example if you run find -iname *.txt
with a file in the current directory called file.txt then the resulting command after shell expansion would be find -iname file.txt
.
To avoid this pitfall you can escape the glob to send the literal string to the find command with find -iname '*.txt'
add a comment |Â
up vote
5
down vote
up vote
5
down vote
Does something include a glob that is being interpreted by the shell? That would cause the expanded filename to be passed to the find command.
For example if you run find -iname *.txt
with a file in the current directory called file.txt then the resulting command after shell expansion would be find -iname file.txt
.
To avoid this pitfall you can escape the glob to send the literal string to the find command with find -iname '*.txt'
Does something include a glob that is being interpreted by the shell? That would cause the expanded filename to be passed to the find command.
For example if you run find -iname *.txt
with a file in the current directory called file.txt then the resulting command after shell expansion would be find -iname file.txt
.
To avoid this pitfall you can escape the glob to send the literal string to the find command with find -iname '*.txt'
answered Aug 26 '16 at 18:54
Jesusaurus
31917
31917
add a comment |Â
add a comment |Â
up vote
0
down vote
If the subfolders are behind symbolic links you have to use the -L option. Try
find -L -iname *something*
According to find man pages
If -L is in effect and find discovers a symbolic link to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched.
New contributor
user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
0
down vote
If the subfolders are behind symbolic links you have to use the -L option. Try
find -L -iname *something*
According to find man pages
If -L is in effect and find discovers a symbolic link to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched.
New contributor
user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
If the subfolders are behind symbolic links you have to use the -L option. Try
find -L -iname *something*
According to find man pages
If -L is in effect and find discovers a symbolic link to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched.
New contributor
user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
If the subfolders are behind symbolic links you have to use the -L option. Try
find -L -iname *something*
According to find man pages
If -L is in effect and find discovers a symbolic link to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched.
New contributor
user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 24 mins ago
user9114986
1
1
New contributor
user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f305964%2fhow-to-force-find-to-recursively-search-subdirectories%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
2
do you have it aliased or hidden with a function?
alias find
anddeclare -f find
output would clarify the situationâ Jeff Schaller
Aug 26 '16 at 17:51
1
What happens when you add a dot after find -
find . -iname something
?â fd0
Aug 26 '16 at 17:53