Warning: Invalid argument supplied for foreach() in /home/techrecipes/public_html/wp-content/themes/techrecipes/header.php on line 77

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.

  • http://dennisquek.com Dennis Quek

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

  • http://www.evucan.com/ Arjun

    Thanks – top tip :)

  • Anonymous

    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?.