Using Find Command Part Two

0
147
Using Find Command Part Two

Using Find Command Part Two

This article is about using find command part two, which is the continuation of using find command part one. The find command is used to search for files and directory in the hierarchy tree on the command line. Find command is one of most useful command to search for files from command line. For more information required about find and options read the man page from one of the following links.

find(1)          find(2)          find(3)          find(4)

Find files using perm operation.

The file command with perm test operation followed by absolute permission value will find all the files of the matching permission.

The find command will find all the files with permission 0555 starting from the current working directory till the last level of the hierarchy. This can also be used with Invert operation to list all the files excluding the files which match the permissions of absolute permission value matches.

or

The above find command will list all the files which don’t have the permission of 0555.

Find files using type operation.

The command with type operation followed by a character of file-type (c) as listed below will list all the files of the type c. Below list shows all the standard file types supported by the find command.

 

Type

Description

b

Block (Buffered) Files

c

Character (Unbuffered) Files

d

Directory Files

p

Named Pipes ( FIFO )

f

Regular Files

l

Symbolic Links

s

Socket Files

# find -type c , here c stands for one of the characters from the above list.

The above find command will list only files starting from the current working directory till the lowest level of the hierarchy.

The above find command will list only directories. The find command can be used with other operation like name, inode etc.

The above command will list all the directories named Linux from current working directory till the lowest level of the hierarchy.

Find files belonging to the specific user.

The find command can also be used to list all the files under a specific user by using the user test operation.

The above command lists all the files of user lincoder starting from the root directory. To find a specific directory or file under the user, we can use the name test operation.

Find files belonging to a specific group.

The find command can also be used to list all the files and directories that are accessed by specific groups

find files using size operation.

We can find files with specifying size test operation.

The above command will list all the files whose size is exactly equal to 50MBs. The size test operation can also be used to find files of size greater than or less than by specifying the operator (+ for greater than or – for less than).

The command will find all the files greater than the 50MBs.

The command will find all the files less than the 50MBs.

That’s it, we are at the end of the article using find command part two. Have any question?
Feel free to ask them in the comments below. Stay tuned for more updates.

SHARE
Previous articleUsing Find Command Part One
Next articleUsing Find Command Part Three
arunvkumr@gmail.com'
Arun is Open Source Enthusiast. He likes to spend most of his time exploring linux distribution, solving puzzles and coding.

LEAVE A REPLY