As a Linux user, you might need to locate files with specific extensions for various reasons, such as managing configurations, troubleshooting, or scripting. For example, finding .ini files can help you manage settings for multiple applications. You can do it using the find command. In this article, I will show how to locate files with the .ini extension in the /etc/ directory.
Here is the command:
sudo find /etc/ -type f -name "*.ini"
The sudo command is used when searching in the /etc/ directory because it may contain files and directories that are only accessible to the. However, If you are searching in the home directory - sudo is not necessary.
In the command mentioned above, /etc/ is the starting directory for the search. The -type f option instructs the find command to look only for regular files, excluding directories and other file types. The -name option specifies the search pattern. In this case, the wildcard pattern is *.ini. The asterisk (*) wildcard is utilized to match any sequence of characters, while .ini specifies the desired file extension at the end.
You can replace ini with any desired extension to find files with different extensions in Linux. If you are interested in learning more about file searching in Linux, consider reading this article.