Pages

Monday, May 5, 2014

How to Find a File in Ubuntu Linux

Use the following commands in your terminal
  • find / -iname filename or partial filename
    Find a File in Linux Step 1Bullet1.jpg
  • find / -iname *.conf

    Find a File in Linux Step 1Bullet2.jpg
  • This will find every instance conf no matter where it is.
  • The / after find tells find to look in every directory below and including the root of the filesystem.
  • The - in front of name tells Linux to not worry about caps.

You can use wildcards such as find / -iname wiki* to find, for example, "wikiHow.dat".

Find a File in Linux Step 2.jpg
  • There are many variables you can use with find.

Type "man find" or "info find" at a terminal prompt for more information then you care to know. Skip the " " when entering the commands.

Find a File in Linux Step 3.jpg
Tips
  • If the list of files is extensive, you can pipe the command to "less" so you can scroll back for forth.
    • find / -iname *.conf | less
  • If you want to send the search results into a file to be read later
    • find / -iname *.conf > ~/myfile
The tilde ~ represents your home directory so if your user name is Joe you can find the filemyfile in /home/joe.
  • The locate command will often find files much faster, but it's not always up to date.
    • locate important-paper
    • locate conf

No comments:

Post a Comment