Linux `find` Command

Linux `find` Command

                  ███████████████████████████████
                  ███   Linux `find` Command  ███
                  ███████████████████████████████

╭─user@hostname ~
╰─$ find [path] [options] [expression]

Common Usages:
───────────────
1. Find Files by Name:
?? find /path/to/search -name "filename"

2. Find Files by Type:
?? find /path/to/search -type f

3. Find Directories:
?? find /path/to/search -type d

4. Find Files Modified Within X Days:
?? find /path/to/search -type f -mtime -X

5. Find Files Larger Than X Size:
?? find /path/to/search -type f -size +Xc

6. Find Files Owned by User:
?? find /path/to/search -type f -user username

7. Find and Execute Commands:
?? find /path/to/search -name "*.txt" -exec command {} \;

8. Find Files and Exclude Paths:
?? find /path/to/search -name "pattern" -not -path "/exclude/path"

9. Find Files and Apply Actions:
?? find /path/to/search -name "*.log" -exec rm {} \;

10. Find Files by Permissions:
??? find /path/to/search -type f -perm 644

11. Find Files by Extension:
??? find /path/to/search -type f -name "*.jpg"

12. Find and Display Results Verbosely:
??? find /path/to/search -type f -print

Options:
───────
-name "pattern"? : Find by name.
-type [f|d]????? : Find files (f) or directories (d).
-mtime +/-X????? : Find files modified +/- X days ago.
-size [+|-]Xc??? : Find files larger (+) or smaller (-) than X bytes.
-user username?? : Find files owned by a specific user.
-exec command {} : Execute a command on found files.
-not -path "p"?? : Exclude specific paths.
-perm mode?????? : Find files with specific permissions.
-print?????????? : Print found files.

For more details, check the man page: man find

╭─user@hostname ~
╰─$ Follow me https://www.dhirubhai.net/in/kevinvanegasz/
        


#linux #programming #java #coding #code #html #programmer #developer #android #css #windows #tech #computerscience #technology #python #javascript #dev #reactjs #developers #engineer #web #webdeveloper #itmanager #laravel #software #rubyonrails #coder #xml #gameofthrones #webdesign

要查看或添加评论,请登录

社区洞察

其他会员也浏览了