The find
command is used to search for files in the directory tree starting from
the location specified. It searches your filesystem live, which causes
the command to run slower than the locate command.
The syntax of the command:
find PATH EXPRESSION
The expression is a way of specifying what you want to find. You can search files by filename, size, permissions, group, UID, etc.
Here is a list of the most commonly used expressions:
We will go through a couple of examples. To find all files and directory that begin with “so” in our current directory, we can use the following command
NOTE – when using the -size expression, use c for bytes, k for Kilobytes, M for Megabytes and G for Gigabytes
To find files owned by a user:
r
To find files with specific permissions:
You can also combine two or more expressions:
In the example above we have found all files that have the permissions of 775 and begin with the letter “t“.
The syntax of the command:
find PATH EXPRESSION
The expression is a way of specifying what you want to find. You can search files by filename, size, permissions, group, UID, etc.
Here is a list of the most commonly used expressions:
We will go through a couple of examples. To find all files and directory that begin with “so” in our current directory, we can use the following command
NOTE – wildcards like * have to be enclosed in double quotes to work with the find command.To find files bigger then 300 bytes:
NOTE – when using the -size expression, use c for bytes, k for Kilobytes, M for Megabytes and G for Gigabytes
To find files owned by a user:
r
To find files with specific permissions:
You can also combine two or more expressions:
In the example above we have found all files that have the permissions of 775 and begin with the letter “t“.
Post a Comment