Tìm Kiếm File Và Thư Mục Trong Linux - Tips & Tricks FIND Command
Có thể bạn quan tâm
Skip to content Search Gists Search Gists All gists Back to GitHub Sign in Sign up Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }}
hoangdh/find-command.md Last active January 7, 2021 16:14 Show Gist options
Instantly share code, notes, and snippets.
- Download ZIP
- Star (1) You must be signed in to star a gist
- Fork (2) You must be signed in to fork a gist
- Embed Select an option
- Embed Embed this gist in your website.
- Share Copy sharable link for this gist.
- Clone via HTTPS Clone using the web URL.
No results found
Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/hoangdh/625c36647500d3bf1a9609d03a3e6e71.js"></script> - Save hoangdh/625c36647500d3bf1a9609d03a3e6e71 to your computer and use it in GitHub Desktop.
- Embed Embed this gist in your website.
- Share Copy sharable link for this gist.
- Clone via HTTPS Clone using the web URL.
No results found
Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/hoangdh/625c36647500d3bf1a9609d03a3e6e71.js"></script> Save hoangdh/625c36647500d3bf1a9609d03a3e6e71 to your computer and use it in GitHub Desktop. Download ZIP Câu lệnh find - Tìm kiếm file và thư mục trong linux - Tips & Tricks FIND command Raw find-command.mdGhi chép tùy chọn của find
- Các tùy chọn hay dùng:
- -name: Tìm kiếm theo tên file/folder
- -type: Theo kiểu, f: Folder; d: Directory
- -mtime N: Thời gian tạo/chỉnh sửa. N: là số ngày
- -exec: Thực thi gì đó với các file tìm được
- -perm: Tìm theo quyền truy cập (RWX)
- -user: Tìm file thuộc sở hữu của user nào đó
- -group: Tìm file sở hữu của group nào đó
- Tham khảo thêm: man find
Một số trường hợp cụ thể
Xóa (Truncate) các file log lớn của Docker
find /var/lib/docker/containers/ -size +1G -iname '*json.log*' -type f -exec truncate -s 0 {} \;Tìm file theo dung lượng lớn hơn 100M
find . -type f -size +100M -exec ls -sh {} \;Chú ý: Nếu muốn tìm dung lượng nhỏ hơn -100M
Tìm file nào đó trong thư mục
find ./folder -print | grep -e '<tên-file>'Tìm file nào đó có quyền thực thi
find ./folder -executableTìm các file mới được tạo sau 1 ngày
find / -atime -1Tìm các file có dung lượng > 100M và mới tạo sau 1 ngày
find / -type f -size +100M -atime -1 -exec du -sh {} \;Xóa các file được tạo sau 15 ngày
find /data/logs/ -type f -mtime +15 -exec rm -rf {} \;Tìm các file được tạo trong vòng 15 ngày trở lại
find /data/logs/ -type f -mtime -15 -exec ls -l {} \;Đếm số file trong thư mục
find . -type f | wc -lĐếm sub-directory trong thư mục
find . -type d | wc -lĐếm tổng số file trong thư mục
find . -print| wc -lTìm các file có quyền khác với 644 và thay đổi
find /tmp -type f ! -perm 644 -exec chmod 644 {} \; Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment You can’t perform that action at this time.Từ khóa » Cách đếm File Trong Thư Mục
-
2 Cách đếm Số Lượng File Trong Thư Mục Windows 10
-
2 Cách đếm Số Lượng File Trong Thư Mục Windows 10
-
Thủ Thuật đếm Số Lượng File Trên Thư Mục Windows 10 Nhanh Chóng
-
Cách đếm Số Lượng Tệp Hoặc Thư Mục Con Trong Một Thư Mục
-
2 Cách đếm Số Lượng File Trong Thư Mục Windows 10
-
Hướng Dẫn Cách đếm Số Lượng File Trong Mỗi Thư Mục Trên Linux
-
Làm Thế Nào để đếm Các Tệp Trong Một Thư Mục / Thư Mục Nhất định ...
-
[Cập Nhật]2 Cách đếm Số Lượng File Trong Thư Mục Windows 10 Mới ...
-
Cách đếm Các Tệp Trong Một Thư Mục Bằng PowerShell, CMD Hoặc ...
-
Đếm Số Lượng Tệp Files Trong Thư Mục Và Thư Mục Con Với VBA
-
Cách đếm Số Lượng File Trong Thư Mục Windows 10 - Vĩnh Long Online
-
Cách đếm Số Mục Trong Thư Mục Trên Windows 11/10 - 101 Help
-
Cách đếm Số Lượng File Trong Folder Linux - Hàng Hiệu
-
2 Cách đếm Số Lượng File Trong Thư Mục Windows 10 - Kenhnews