Little about Find


romy4 аватар

romy4 - Posted on 17 Октябрь 2015

  1. Find large files
    find /home -type f -size +5000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
  2. Find files / directories with 777 permissions
    #find 777 files
    find / -type f -perm 0777
    #find 777 dirs
    find / -type d -perm 0777

    You can also combine find to skip some folders when copying using this article. Prune tells it to also skip subfolders and subfiles.

    find . ! \( -name images -prune \) -print | cpio -o | ttcp -t yourserver.com -p 10000
  3. Find empty files
    find /home -type f -size -1b -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
  4. Find empty files and delete
    find /tmp -type f -empty -delete
  5. Find smallest files and delete them
    ls . -S | tail -250 | xargs rm
  6. Find largest files
    ls . -Srl | tail -250
0
Ваша оценка: Ничего

Отправить комментарий

Google Friend Connect (leave a quick comment)
loading...
Содержание этого поля является приватным и не предназначено к показу.