[Intro Music]
So far we have talked about
different Linux features, about
management of directories files,
about Linux soft and hard, and so
on. And now it's time to talk about
the 'find' command. And using this
command you could easily and fast
find different files and folders
using different filter criteria.
And first of all please verify
whether 'find' is available in
command line. Please type 'find'; and
yes this command is available. And
as you see when you simply enter a
'find' command you already see some
results. And basically in this
case, you see all files and folders
that are located in current
directory. And at the moment the
current directory is home directory
for this particular user, it is
'/root'. And here above you see
a whole list of all files located
in this folder. And recap that
we have created several files
and directories before. Let me
list them as 'ls -la'; and I see for
example such folder as
'etc-backup-2'; and actually
this folder was copied from 'etc'
folder. Also, before we have created
such files as 'file1.txt',
'file2.txt', and so on. 'find' command
is very, very powerful; and it has
a lot of different options. And
before showing you some examples,
please open up 'man pages' for this
command. Open up Google Chrome; and
type here 'man pages find'; and click
on this first link; and here you'll
see description of this 'find' the
command. And it is used for search
of files and directories. Here is a
large description of this command,
and afterwards you see some
options. And here's the difference
between the 'find' and other commands
that we have used before. 'find'
command has regular options like
'-P', capital P, '-L', and
so on. But it also has additional
options that come after argument.
And this part of command is called
Expression.
Argument for 'find' command is
actually path to a specific
folder. For example, as argument
you could use '.'; 'find' and '.'. '.'
here is argument for 'find' command.
Or you could use as argument for
example, such path, '/bin'.
Or you could use the relative path
like '../', and so on. It
is argument for 'find' command. But
after argument, you could use
additional options that are
available only in 'find' command. And
this part that comes after this
argument, after path is called
expression. An expression consists
of multiple options, and you could
use multiple options
simultaneously. For example, if you
scroll down, you'll see such
options as '-daystart',
'-follow', '-regextype', and so on. And
please notice here difference
between options that we have used
and discussed before, and those
options. I have told you before that
single dash is used with single
character options like '-l', '-c',
and so on. But here you see
that here long versions of options
like 'daystart' are used with single
dash, and that's because those
options are called positional
options, and they are used inside
of the expression that comes after
arguments inside of the 'find'
command. All right, that is the
structure of the 'find' command. It
contains a regular options,
argument, and additional expression
that contains different options
like 'daystart', and so on. If you
scroll down here, you may find a
bunch of such kind of options like
'maxdepth', 'mindepth', 'mount', and so
on. And if you scroll down, you may
find some examples of usage of this
'find' command. Here they're. And for
example, in this command, this
'/tmp' is actually argument; and
after argument, you see multiple
operators. Here's operator
'-name', here's one more operator
'-type', and here's additional
operator '-print'. Notice that some
of those operators may have own
arguments, and 'core' here is argument
for this '-name' operator; 'f' is
argument for this operator,
'-type'; and '-print' doesn't have
any operators. Also if you want you
could pipe result of 'find' command by
stdout to stdin of another
command. And in one of the next
lectures I will explain you what is
'xargs' here. For now, please
understand that 'find' contains
non-traditional arguments; and they
come after argument that is
actually path to specific folder.
Alright, now let's dive into
examples; and let's examine
capabilities of 'find' command. But
let's proceed with that after the
small pause. See you next. Bye.
[no audio]