/ factorpad.com / tech / linux-essentials / find-command.html
An ad-free and cookie-free website.
Beginner
Learn to find files within directories at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux find Command Summary with Examples (3:22)
Our thirtieth word, or command to memorize is
find
from our category
Help.
find
allows you to search for files
within directories.
-options | description |
---|---|
--help |
Print help screen |
-name |
Find files with a specific name or expression |
Recall from the previous video, we searched through command titles and descriptions, now we'll search for any type of file.
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s)
.
The find
command has
many options, and arguments include where you want to
search, operations you want to perform, and finally an expression of
what you're looking for. The capabilities of the
find
command are vast, so we'll look
at a few simple cases.
Like most commands, help is available with double-dash
--help
. The
-name
option offers the ability to
search by file name or an expression using wildcards. I'm reluctant to
detail other options here, so at this point let's be content with
finding files.
So why is find
an important command?
Well, its capabilities are extensive, meaning you can use it to
simply find a file or to take other actions on those files.
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go, let's start with a
find --help
and scan that syntax.
It gets very very complex, so I suggest reviewing it later.
Next, let's go with find in the current directory using a dot
.
then
-name
and the title like this
'video11.txt'
.
Okay, good.
And last, let's broaden the search using a wildcard. Typing
find -name 'video1*.txt'
.
Again, I'm reluctant to go any deeper at this point given the short window of time here.
Okay now you know how to use find
.
And you know the syntax for commands, options and arguments.
One last tip about the find
command.
The man page (man find
) has guidance
on how to locate and take actions on a file at the same time. I
suggest looking at that.
Okay, thanks for visiting today. I hope this was a helpful
introduction to the find
command.
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
Click below to subscribe to an extraordinarily helpful YouTube Channel. For updates, try out our no-spam email list and @factorpad on Twitter.
apropos
command,
hit Back.sort
command,
click Next./ factorpad.com / tech / linux-essentials / find-command.html
A newly-updated free resource. Connect and refer a friend today.