Find File By Name In Linux

The find command can be used for this.

The first parameter is the directory we will start the search in, which will be a recursive search. The -type flag with the "f" option tells the command to look for files. The -name flag contains the string of the filename we are looking for. The filename can have wildcards if you want to match for part of the file.

To search for files on the computer with the filename that ends with "*launcher.conf".

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

You will be searching the entire hard drive here, so there will be a few errors caused by the permissions issues attempting to look at files you don't have access to. You can either add sudo to bypass this, or just suppress the error output in the following way.

find / -type f -name "*launcher.conf*" 2>/dev/null

The alternative to this is to find all files and use grep to perform a search for the file in question.

find / -type f 2>/dev/null | grep "*launcher.conf"

Add new comment

The content of this field is kept private and will not be shown publicly.