find - , Linux. , , .

Find Linux . :
$ find directory-to-search criteria action
:
directory-to-search
- , .criteria (test)
- ,action
- , ,
. a.txt
:
$ find . -name "a.txt" ./a.txt
:
.
--name
, -name
A.txt
. , , -iname
:
$ find . -iname "a.txt" ./a.txt ./A.txt
.jpg
* .jpg
:
$ find . -name "*.jpg" ./genxfacebook2.jpg ./genxfacebook1.jpg ./Moodle2.jpg ./moodle.jpg ./moodle/moodle1.jpg ./genxfacebook.jpg
. , .jpg
/home
:
$ find /home -name "*.jpg" find: `/home/ubuntu/.ssh': Permission denied /home/vagrant/Moodle2.jpg /home/vagrant/moodle.jpg /home/me/hello.jpg find: `/home/me/testfiles': Permission denied find: `/home/me/data': Permission denied /home/me/water.jpg find: `/home/me/.cache': Permission denied
2 >/dev/null
. /dev/null
:
find /home -name "*.jpg" 2>/dev/null /home/vagrant/Moodle2.jpg /home/vagrant/moodle.jpg /home/me/hello.jpg /home/me/water.jpg
-type
. :
f plain files d directories l symbolic links b block devices c character devices p named pipes s sockets
, -type d
:
$ find . -type d . ./.ssh ./.cache ./moodle
, . -size
1G
. 1 .
$ find . -size +1G ./Microsoft_Office_16.29.19090802_Installer.pkg ./android-studio-ide-183.5692245-mac.dmg
+
, , . - , . .
. :
b
- 512c
-k
-M
-G
-
-empty
:
$ find . -empty ./.cloud-locale-test.skip ./datafiles ./b.txt ... ./.cache/motd.legal-displayed
-cmin
. , 60 ( 60), -60
:
$ find . -cmin -60 . ./a.txt ./datafiles
, 60 , 60
.
-atime
. , , 180 :
$ find . -atime +180
, .
-user username
, . , , ubuntu /home
:
$ find /home -user ubuntu 2>/dev/null /home/ubuntu /home/ubuntu/.bash_logout /home/ubuntu/.bashrc /home/ubuntu/.ssh /home/ubuntu/.profile
, ? -perm
. 777
:
$ find /home -perm 777
:
-and
-or
-not
, , 100MB, :
$ find /home -user me -and -size +100M 2>/dev/null /home/me/kali-linux-2020.3-installer-netinst-i386.iso
, 100MB, me
vagrant
:
$ find /home \( -user vagrant -or -user me \) -and -size +100M 2>/dev/null /home/vagrant/LibreOffice_7.0.1_Linux_x86-64_deb.tar.gz /home/me/kali-linux-2020.3-installer-netinst-i386.iso
, .
find , . .
-delete
- ,-ls
- ls-print
- . ,-exec
-
, , :
$ find . -empty -delete
! -print
.
-exec
. . :
-exec command {} \;
command
, , ,rm
,mv
cp
.{}
.- .
, :
$ find . -empty -exec rm {} \;
-exec
. PNG- backup/images
:
$ find . -name "*.png" -exec cp {} /backups/images \;
find , , , (), , , . , , .
, find, . - !