x
Loading
 Loading
Hello, Guest | Login | Register

Finding Stuff

Have you ever lost a file because you couldn’t remember where you put it? Losing files is a common experience when learning a new operating system, and Linux users are hardly immune to it. The good news is that Linux provides the find command, which can help you banish the lost file experience from your daily routine. The better news is that find is extremely powerful and can help you do a lot more than just find lost files. Of course, a command this useful can take a while to master, so this month we’re going to explore some of find’s ins and outs.

Have you ever lost a file because you couldn’t remember where you put it? Losing files is a common experience when learning a new operating system, and Linux users are hardly immune to it. The good news is that Linux provides the find command, which can help you banish the lost file experience from your daily routine. The better news is that find is extremely powerful and can help you do a lot more than just find lost files. Of course, a command this useful can take a while to master, so this month we’re going to explore some of find’s ins and outs.

Finding Files by Name

A basic use of the find command is locating a file by its name. Of course, if you store every file in a single directory, being able to find a file by its name is not very impressive; the familiar ls command serves this purpose quite adequately.

The find command is helpful when you have a deeply nested collection of directories that contain other directories. For example, suppose you know that the file httpd.conf resides somewhere on your system but you don’t recall where. You can issue the following find command to locate the file:

find / -name httpd.conf 

The syntax of the find command is admittedly a bit hairy, and we’ll dissect it in a minute. But the command we just issued would output a list of files having the name httpd.conf:

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. KDE 4.4: Does It Work Yet?
  2. Writing Custom Nagios Plugins with Python
  3. Power Up Linux GUI Apps
  4. Tweeting from the Command Line with Twyt
  5. When Memory Serves You: Using ramfs and tmpfs
Follow Linux Magazine
Rackspace