31 Mart 2022 Perşembe

find komutu dosya tipine göre arama seçenekleri

Giriş
Açıklaması şöyle
Since there are many different types of files and directories, it is not always useful to just search for a specific string. If we want to mention the type of file or directory we are looking for, we can specify it with the -type option. To remove ambiguity, we also add the -name option before our search string. You can also just remove the search string entirely, and search for a particular file type.
Dosya tipleri şöyle
A full list of all types can be found below:

b - block devices
c - character devices
d - directory
p - named pipe (FIFO)
f - regular file
l - symbolic link - never used if we use the symbolic link -L option.
s - socket
Örnek - regular file
Şöyle yaparız
find ./test -type f -name "*.txt"
Örnek - symbolic link
Bir dizindeki symbolic linkleri silmek için şöyle yaparız
find /path/to/directory -maxdepth 1 -type l -delete

Hiç yorum yok:

Yorum Gönder