Telegram- 👇 😉
-
. WIKIMERIONET
Merion Mertics , ,

CRM

8

- Linux find. , . .


find type d. find :

$ find /path/to/search -type d -name "name-of-dir"
   find

Linux , , . :

$ find /path/to/search -name ".*"

find , . 10 :

$ find /path/to/search -size +10M

:

$ find /path/to/search -size -10M
$ find /path/to/search -size 10M

.

$ find /path/to/search -size +100M -size -1G

, , .txt. find grep. , .

$ find /path/to/search | grep -f filelist.txt

f grep . , .


,

Linux , . , . grep vf, , .

$ find /path/to/search | grep -vf filelist.txt

, find . , "/", . maxdepth .

$ find . -maxdepth 0 -name "myfile.txt"

. .

$ find . -maxdepth 1 -name "myfile.txt"

find . empty. . d:

$ find /path/to/search -type f empty
$ find /path/to/search -type d empty

. :

$ find /path/to/search -type f -empty delete

, find / :

$ find /path/to/search -type f -printf "%s\t%p\n" | sort -n | tail -1

, Linux: sort tail. Sort , tail , /. , :

$ find /path/to/search -type f -printf "%s\t%p\n" | sort -n | tail -5<

. :

$ find /path/to/search -type f -printf "%s\t%p\n" | sort -n | head -5

:

$ find /path/to/search -type d -printf "%s\t%p\n" | sort -n | tail -1

setuid

setuid root-. find . , : -user perm. , root- :

$ find /path/to/search -user root -perm /4000
    Linux

exec find. :

$ find /path/to/search -user root -perm /4000 -exec ls -l {} \;

root root-:

$ find /path/to/search -perm /4000

sgid

sgid SUID , 4000 2000:

$ find /path/to/search -perm /2000

, :

$ find /path/to/search -perm /6000

,

. , .

Permission denied

. , stderr stdout grep . find , "Permission denied"^

$ find / -name "myfile.txt" 2>%1 | grep -v "Permission denied"

X

, mtime. , 30 , 30 30 :

$ find /path/to/search -type f -mtime 30
$ find /path/to/search -type f -mtime +30<
$ find /path/to/search -type f -mtime -30

exec:

$ find /path/to/search -type f -mtime -30 -exec ls -l {} \;

printf sort:

$ find /path/to/search -printf "%T+\t%p\n" | sort

sort . r sort:

$ find /path/to/search -printf "%T+\t%p\n" | sort r

locate find

Linux , locate. , find, , .

$ locate myfile.txt

locate , , . locate , find. , , , 24 . updatedb.

locate , find , .

, , find.


CPU find

find . , , find , ionice nice.

:

$ top

/ find, :

$ ionice -c3 -n7 find /path/to/search -name "myfile.txt"

CPU, :

$ nice -n 19 find /path/to/search -name "myfile.txt"

, /, CPU.