Friday 28 June 2019

How to Use All Linux’s Search Commands

Concept of a Linux terminal full of text on a laptop

Linux offers six different ways to search, and each has its merits. We’ll demonstrate how to use find, locate, which, whereis, whatis, and apropos. Each excels at different tasks; here’s how to choose the right tool for the job.

You’re spoiled for choice when it comes to commands for searching and finding in Linux. Why so many? Well, they each have their specialties and perform better than the others in certain circumstances. You could think of them as a sort of Swiss-Army knife for searching. We’re going to look at each blade in turn and find out its particular strengths.

The find Command

The behavior of the find command is difficult to determine by trial and error. Once you understand the syntax, you start to appreciate its flexibility and power.

The simplest way to use find is to just type find and hit enter.

find

find command in a terminal window

Used in this way find behaves like ls, but it lists all of the files in the current directory and those in subdirectories.

output from find command in a terminal window

Some implementations of find require you to put the . for the current directory. If this is the case with your version of Linux,  use the following command:

find .

Read the remaining 177 paragraphs



from How-To Geek https://ift.tt/2RIFO69

No comments:

Post a Comment