Geniş Ekran Modu Otomatik Ekran Boyutu Font Boyutunu Azalt Font Boyutunu Azalt Font Boyutunu Normal Yap Yazdır

find komutu ve kullanımı

List all filenames ending in .mp3, searching in the current folder and all subfolders:
$ find . -name "*.mp3"

List all filenames ending in .mp3, searching in the music folder and subfolders:
$ find ./music -name "*.mp3"

List files with the exact name: Sales_document.doc in ./work and subfolders:
$ find ./work -name Sales_document.doc

List all files that belong to the user Maude:
$ find . -user Maude

List all the directory and sub-directory names:
$ find . -type d

List all files in those sub-directories (but not the directory names)
$ find . -type f

List all the file links:
$ find . -type l

List all files (and subdirectories) in your home directory:
$ find $HOME

Find files that are over a gigabyte in size:
$ find ~/Movies -size +1024M

Find files have been modified within the last day:
$ find ~/Movies -mtime -1

Find files have been modified within the last 30 minutes:
$ find ~/Movies -mmin -30

Find .doc files that also start with 'questionnaire' (AND)
$ find . -name '*.doc' -name questionnaire*

List all files beginning with 'memo' and owned by Maude (AND)
$ find . -name 'memo*' -user Maude

Find .doc files that do NOT start with 'Accounts' (NOT)
$ find . -name '*.doc' ! -name Accounts*

Find files named 'secrets' in or below the directory /tmp and delete them. Note that this will work incorrectly if there are any filenames containing newlines, single or double quotes, or spaces:
$ find /tmp -name secrets -type f -print | xargs /bin/rm -f

Find files named 'secrets' in or below the directory /tmp and delete them, processing filenames in such a way that file or directory names containing single or double quotes, spaces or newlines are correctly handled. The -name test comes before the -type test in order to avoid having to call stat(2) on every file.
$ find /tmp -name secrets -type f -print0 | xargs -0 /bin/rm -f

Run 'myapp' on every file in or below the current directory. Notice that the braces are enclosed in single quote marks to protect them from interpretation as shell script punctuation. The semicolon is similarly protected by the use of a backslash, though ';' could have been used in that case also.

find . -type f -exec myapp '{}' ;

Traverse the filesystem just once, listing setuid files and directories into /root/suid.txt and large files into /root/big.txt.

find / ( -perm -4000 -fprintf /root/suid.txt '%#m %u %pn' ) ,
( -size +100M -fprintf /root/big.txt '%-10s %pn' )

Search for files in your home directory which have been modified in the last twenty-four hours. This command works this way because the time since each file was last modified is divided by 24 hours and any remainder is discarded. That means that to match -mtime 0, a file will have to have a modification in the past which is less than 24 hours ago.

find $HOME -mtime 0

Search for files which have read and write permission for their owner, and group, but which other users can read but not write to (664). Files which meet these criteria but have other permissions bits set (for example if someone can execute the file) will not be matched.

find . -perm 664

Search for files which have read and write permission for their owner and group, and which other users can read, without regard to the presence of any extra permission bits (for example the executable bit). This will match a file which has mode 0777, for example.

find . -perm -664

Search for files which are writable by somebody (their owner, or their group, or anybody else).

find . -perm /222

All three of these commands do the same thing, but the first one uses the octal representation of the file mode, and the other two use the symbolic form. These commands all search for files which are writable by either their owner or their group. The files don't have to be writable by both the owner and group to be matched; either will do.

find . -perm /220
find . -perm /u+w,g+w
find . -perm /u=w,g=w

Both these commands do the same thing; search for files which are writable by both their owner and their group.

find . -perm -220
find . -perm -g+w,u+w

These two commands both search for files that are readable for everybody (-perm -444 or -perm -a+r), have at least on write bit set (-perm /222 or -perm /a+w) but are not executable for anybody (! -perm /111 and ! -perm /a+x respectively)

find . -perm -444 -perm /222 ! -perm /111
find . -perm -a+r -perm /a+w ! -perm /a+x

 

Kaynak ss64.com/bash/find.html#examples

Bu içerikle ilgili henüz herhangi bir yorum yapılmamıştır. Bu içerikle ilgili Yorumunuzu eklemek için burayı tıklayınız.

Linux Bash Script

Sunucudaki Hesapların ve Veri Tabanlarının Yedeğin...
Bir Linux Web Sunucusu üzerindeki sitelere ait dosyaları ve veri tabanlarını sistemde yedekleyen örn...
Klasördeki dosyaları silmek
bash script ile sunucuda oluşturlan temp dosyalarını silmek
Klasördeki dosyaları türüne göre listelemek
bash script ile dosya türüne göre listeleme islemi
Klasördeki dosya listesini almak
bash script kullanılarak bir klasor icerisindeki dosya listesini almak

    Ödev Gönder | İncelenmeyi Bekleyen Ödevler | Uygulama Resimleri | Uygulama Resmi Gönder | İnternet Üzerinden Sınav | Test Sorusu Gönder | Sınıf Karneleri | Anketler | Linkler
    www.dijitalders.com

    bilgidijitalders.com
    Bu sayfalar en iyi 1024 x 768 ekran çözünürlüğünde görüntülenir.
    Site içerikleri, site kullanıcıları tarafından yollanan içeriklerdir. Her hangi bir içeriğin lisanslı yahut şahsınıza ait olduğunu tarafımıza iletirseniz gerekli düzenlemeyi yapacağız. Kullanılan içerikler, siteyi kullanan öğrenciler ve araştırmacılar için kolaylık sağlamak amacıyla oluşturulmuştur.
    Sayfada HATA! Olduğunu Düşünüyorsanız | Sık Kullanılanlara Ekle | www.dijitalders.com'u Ana Sayfam Yap | Web Tasarımcıya e-Posta
    Bu site 914,457 kişi tarafından ziyaret edilmiştir.