Linux find command


  Translation results:

find

英[faɪnd] 美[faɪnd]

v.find;discover;find out;discover

n.find something ;The person who was found

Third person singular: finds Present participle: finding Past tense: found Past participle: found

Linux find commandsyntax

Function: The find command is used to find files in the specified directory.

Syntax: find path -option [ -print ] [ -exec -ok command ] {} \;

Linux find commandexample

List all files with file extension c in the current directory and its subdirectories.

# find . -name "*.c"

List all general files in the current directory and its subdirectories

# find . -type f

List all files in the current directory and its subdirectories that have been updated in the last 20 days

# find . -ctime -20

Find ordinary files in the /var/log directory that were changed more than 7 days ago, and ask them before deleting:

# find /var/log -type f -mtime +7 -ok rm {} \;

The owner of the file in the directory before searching has read and write permissions, and the group to which the file belongs Files that the user and other users have read permission for:

# find . -type f -perm 644 -exec ls -l {} \;

To find all normal files with file length 0 in the system and list their full paths:

# find / -type f -size 0 -exec ls -l {} \;

Popular Recommendations

Home

Videos

Q&A