Linux SRC

  • Increase font size
  • Default font size
  • Decrease font size
Home FAQ General Find something

Find something

E-mail Print PDF

Here are some cool 'find' oneliners:

 

This command will find all files in /home directory with .doc as extension and was modified 24 hours ago:

#> find /home -name *.doc -mtime 1

This one will find the same files, but not directories, and delete them using -exec option (great for disk usage maintenance, but BACKUP first!):

#> find /home -name *.doc -type f -mtime 1 -exec rm ’{}’ \;

You can also find files owned by a certain UID:

#> find /tmp -user johndoe find /tmp -uid 502

Or by GID:

#> find /home/development -gid 1000

You can also search for files and directories with certain permissions:

#> find . -perm -777

Enjoy!