Bash Tricks compilation

This page is develop to be used as a reference for some bash tricks

find . -name "*md"

find {folder} -{flag} {"REGEX"}

Find

find .

find . -type {d|f}

d for directory

f for file

find . -type f -[i]name {"REGEX"}

i stands for case insensitive search

find . -type f -mmin -10

Get all the files modified less/more than {-|+}10 minutes ago.

mmin stands for modifed minutes and mtime stands for days. Analogous you can use amin access minutes and atime access time(in days) and cmin for changed minutes and ctime for changed days. Also you can define a range:

find . -type f -mmin +1 -mmin -5

find . -size {+|-}5{K|M|G}

find . -empty Search all empty

find . -perm 777Search files/folders with permissions 777

find {folder} -exec chwon <user>:<group> {} +

Where {} is a placeholder for matches and + is how you end the command

To stop recursion, specify the max depth

find . -type f -name "*.jpg" -maxdepth 1