Linux: How can I find a file on my system?

Posted on in Categories , , , , , , , , last updated December 27, 2006

Q. I have remove server. I login through SSH program. How do I find a file called xyz on my Linux server system?

A. You can use find command. It search for files in a directory hierarchy under Linux and all other UNIX like oses. Use find command to find a file from shell prompt.

Find command syntax

find Search-Directory-Path -name file-name-to-search

Examples

To find a file called zyz in /home/user directory type the command:
$ find /home/user -name xyz

To find a file called passwd in / (search entire system) directory type the command:
$ find / -name passwd

See this previous article for more info.

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

Share this on (or read 2 comments/add one below):

2 comment

  1. Awesome! Thank you so much. This will definitely come in handy sometime(and right now…when I googled how to do it…lol) :).

  2. To find a file called zyz in /home/user directory type the command:
    $ find /home/user -name xyz
    you mean to say To find a file called xyz ???

    Have a question? Post it on our forum!