Get the App
SLTechnology News&Howtos  ›  Servers  › 

The use of find Command in Linux system

Shulou Source: shulou.com Published: 2022-06-01 10:18:14 09月16日 Update

This article mainly introduces "the use of the find command under the Linux system". In the daily operation, I believe that many people have doubts about the use of the find command under the Linux system. The editor consulted all kinds of materials and sorted out a simple and easy-to-use operation method. I hope it will be helpful to answer the doubts about the use of the find command under the Linux system. Next, please follow the editor to study!

Find command

1. Time-related commands

-atime n: n is a number, meaning files that have been accessed (access) within a day before n days.

-ctime n: n is a number, meaning a file that has been modified (change) within one day before n days.

-mtime n: n is a number, meaning a file that has been modified (modification) within one day before n days.

-newer file: file is an existing file, meaning that as long as the file is newer than file, it will be listed.

two。 Parameters related to the user or user group name:

-uid n: n is a number, which is the user's account number ID, or UID, and the UID is recorded in / etc/passwd corresponding to the account name.

-gid n: n is a number, which is the ID of the user group name, or GID, and this GID is recorded in / etc/group.

-user name: name is the user account name, such as dmtsai

-group name: name is the name of the user group, such as users

-nouser: the owner of the lookup file is not in / etc/passwd

-nogroup: find files whose owner is not in / etc/group.

3. Parameters related to file permissions and names:

-name filename: search for a file named filename

-size [+ -] SIZE: search for files larger (+) or smaller (-) than SIZE. The specifications of this SIZE are: C: for byte,k: for 1024bytes, so to find a file larger than 50KB, it is "- size + 50K"

-type TYPE: the type of search file is TYPE, and the main types are: general formal file (f), device file (bjournal c), directory (d), connection file (l), socket (s), and FIFO (p) and other attributes.

-perm mode: search for files whose attribute "happens to be" mode, which mode is similar to chmod. For example, if the attribute of-rwsr-xr-x is 4755, it will be listed.

-perm + mode: search for files whose file attribute "contains the attributes of any mode". For example, when we search for-rwxr-xr-x, that is,-perm + 755, but a file attribute of-rw- will also be listed because it has-rw.... The attribute of exists.

4. Additional actions:

-exec command: command is another command,-exec can be followed by additional commands to process the search results.

-print: print out the result. This is the default action.

At this point, the study on "the use of find commands under the Linux system" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Files attributes searches commands numbers names users systems learning for example meaning user groups accounts actions parameters owners more types results help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Technology Redmi Microsoft Huawei