Quick Answer: Linux How to Search for a File?
Contents

How do I search for a file in Linux?

To search /etc/passwd file for the user harry, enter the following command.

If you want to search for a word, and avoid matching substrings use ‘-w ‘option.

Just doing a normal search will show all the lines.

The following example is the regular grep where it is searching for “is”.

How do I find a file in Terminal?

To find files in Linux terminal, do the following.

  • Open your favorite terminal app.
  • Type the following command: find /path/to/folder/ -iname *file_name_portion*
  • If you need to find only files or only folders, add the option -type f for files or -type d for directories.
Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest