Howto: Find A File In Linux Operating Systems

Posted on in Categories last updated December 15, 2009

How Do I find a file in Linux operating systems?

You need to use the find command to search for files in a directory hierarchy under Linux operating systems.

find Command Syntax

Open the terminal and type the following commands:

find /dir/to/search -name filename

OR

find /dir/to/search -iname "*.txt"

For example, search a file called foo.c in /home/projects directory, enter:

find /home/projects -name "foo.c"

To find all *.sh file, enter:

find /home/projects -name "*.sh"

To match uppercase and lowercase version of foo.c or FOO.c, enter:

find /home/projects -iname "foo.c"

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

1 comment

Leave a Comment