UNIX/Linux: Easily Find or Search Files or Directories

If you are new to Linux, you may find shortcuts like this one helpful. This tutorial explains how to find a file or directory from the command line.

    Note: This is the UNIX version of DOS’s dir/s.

    When searching for a file or folder, you can use the following commands:

    To search the current directory and all subdirectories for a folder or file, use the following command:

    find . -name filename

      – where “filename” is the file or folder for which you are looking

    To search one directory and all its subdirectories, use the following command:

    find foldername -name filename

      – where “filename” is the file or folder for which you are looking and “foldername” is the folder in which you want to search

The Conversation

Follow the reactions below and share your own thoughts.

3 Responses to “UNIX/Linux: Easily Find or Search Files or Directories”

  1. February 02, 2009 at 5:38 am, Dennis Quek said:

    Oh god thanks… this is so much clearer than other sites.. some examples will be good.

    Reply

  2. September 22, 2009 at 4:12 pm, Arjun said:

    Thanks – top tip :)

    Reply

  3. February 11, 2010 at 4:58 pm, Anonymous said:

    All the help I see is to search for files. What if I want to search a file or multiple files for a value or text in those files?.

    Reply

Leave a Reply