18 Mart 2018 Pazar

locate komutu

Giriş
locate komutu find komutuna alternatif olarak kullanılabilir.Açıklaması şöyle
The locate command matches the provided pattern to its database. 
Nasıl Çalışır
Açıklaması şöyle
"locate and slocate consult database files about the system (usually compiled and updated by a cron job) to find file or command names instantly. On most Linux systems, locate is a symbolic link to slocate".
Örnek
Şöyle yaparız.
$ locate uname
/bin/uname
    (... SNIP dozens of Windows files on C & D ...)
/usr/lib/klibc/bin/uname
/usr/lib/plainbox-provider-resource-generic/bin/uname_resource
/usr/share/man/man1/uname.1.gz
/usr/share/man/man2/oldolduname.2.gz
/usr/share/man/man2/olduname.2.gz
/usr/share/man/man2/uname.2.gz
globbing
Açıklaması şöyle
If --regex is not specified, PATTERNs can contain globbing characters. If any PATTERN contains no globbing characters, locate behaves as if the pattern were *PATTERN*.
Örnek - globbing
Şöyle yaparız.
$ locate *version.h*
Örnek - globbing
Şöyle yaparız
$ set -x
$ 
$ locate /bin/bash*
+ locate /bin/bash
/bin/bash
/snap/core/10577/bin/bash
/snap/core/10577/usr/bin/bashbug
/snap/core/10583/bin/bash
/snap/core/10583/usr/bin/bashbug
/snap/core18/1932/bin/bash
/snap/core18/1932/usr/bin/bashbug
/snap/core18/1944/bin/bash
/snap/core18/1944/usr/bin/bashbug
/usr/bin/bashbug
Örnek
Şöyle yaparız.
$ locate libXft.so.2
/usr/lib/x86_64-linux-gnu/libXft.so.2
/usr/lib/x86_64-linux-gnu/libXft.so.2.3.2

Hiç yorum yok:

Yorum Gönder