Sunday, April 28, 2024
316
rated 0 times [  316] [ 0]  / answers: 1 / hits: 566714  / 3 Years ago, mon, october 25, 2021, 2:44:29

I want to search for all .conf files in /etc/.


I tried grep -r *.conf /etc, but the result isn't right.


What am I doing wrong?


More From » command-line

 Answers
1

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command below:



find . -type f -name "*.txt"


This will list all files with the extension .txt.



The . at the start denotes the current directory. find searches recursively in all the directories below the given path. If you want the search to start somewhere other than the current working directory, specify the path, for example:



find /etc -type f -name "*.conf"


This searches the /etc directory and all its subdirectories for regular files with the .conf extension.


[#29906] Tuesday, October 26, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
peafowkes

Total Points: 356
Total Questions: 102
Total Answers: 117

Location: Lebanon
Member since Tue, Oct 12, 2021
3 Years ago
peafowkes questions
;