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?
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?
Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command below:
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:This searches the
/etc
directory and all its subdirectories for regular files with the.conf
extension.grep
searches the contents of files, not the file names.To find all
.conf
files in/etc/
you'll want find:I'd personally use
find
, but you can glob for these things too:And you can use locate and it's fast but not reliable.
The find command is slow, use this command will give you result immediately:
More info about
locate
command (inmlocate
package) can be found here: https://medium.com/@thucnc/the-fastest-way-to-find-files-by-filename-mlocate-locate-commands-55bf40b297abThe following command will return all files and folders ending in
.conf
:To find only files, run: