[Intro Music]
Now you know how to find specific
files with specific extensions
using the 'find' command. And you have
seen that it would search for files
and folders in different paths. For
example, you could use absolute
path to root folder using simply
'/', or you could omit the
argument and in such case, 'find'
will use the current directory you
are currently in. Now, let me show
you some additional examples. Let's
try to find all files. In such
case, you could use such command as
''find .'; next comes '-type'
operator; and next you could
type here 'f' that stands for file.
Let's press Enter. And I have found
all files in current directory. I
could search for directories only.
In such case, replace 'f' with 'd', like
this, '-type d', directory. And now I
have found all directories. Next, you
could find only links, '-type
link'. Here you see only links. But
actually you see here only list of
files with corresponding paths to
every file, it is not convenient.
And we have used before 'ls' command
with option '-l', that has shown
us table with the permissions, the
size and so on. There is such
option here in 'find' command; and
this option is that '-ls', like so.
Let's press Enter now. And now I
see files in table format. But the
formatting is a bit weird here. But
anyway, here in the first column,
you see inode number, afterwards you
see here permissions, and you see
that in all files first letter
here is 'l', that's because we were
looking for links. Also here you
see user and the group, next comes
date of modification and
afterwards, link itself. But notice
that this output isn't formatted
using different colors. And it is
not really convenient to read.
Let's repeat the same action but
use directories with '-ls'
option. And now I see only
directories, and here you see 'd' in the
beginning of permissions sections.
Alright. Next, you could find only
empty files. For that you could use
'empty' option, 'find .'; and
let's look only for files; and
let's add here option 'empty'. I
am looking only for empty files in
current directory. And for example
here was empty file, let me copy
its path and read this file, 'cat', and
here will be actually result; and
this file is really in fact empty.
That's how you could search for
empty files. Alright, next example.
In the next example, let me show
you how to search for files,
depending on size of the file.
So, 'find .'; and let's look only
for files, '-type file'; and here will
be operator '-size'; and here using
following syntax like, '+10',
let's say 'K', I will search for
files that are larger than 10
kilobytes. Let's do that. And I
have found two files. Let's add
here also 'ls' option; and I'll see
actual size of those two files. And
both sizes are larger than 10
kilobytes. Recap that those sizes
are in bytes here. All right, let's
search for files that are larger
than one megabyte, and let's look
for files in all files and folders
that are subfolders of 'root'
directory. Enter. Then I found for
example, such file as 'perl'. That is
around three and a half megabytes.
Also, there are other files and
again, all files in this table are
larger than one megabyte. But
please notice that this output is
not really convenient, and is not
really nice looking, and it doesn't
have any colors like output of 'ls'
command; and it is actually
possible to reformat this output
and print it like 'ls' command
prints. But I'll show you that in
the next lecture. Now let me show
you one more example. And you could
use file permissions in order to
find the file with specific file
permission. And let me remove the
'size' operator; and instead of it
let's type here '-perm', that stands
for permission; and as argument
let's type here '777'; and let's
search for such files with such
permission only in current
directory, like this. And actually
no files were found. Let's modify
this and let's search for all files
and folders like this. And now I
I see all links actually with read,
write, and execute permissions for
all users. You see those results
here. I will explain you actually
those permissions a bit later in
details, and I will demonstrate to you
how to change permissions, and we
will talk about that
when I explain you how to create
executable scripts. Alright, that's
some options that you could use
with 'find' command; and next after the
small pause let me explain to you how
to execute additional command after
'find' command. I'll see you next. Bye.
[no audio]