examples of find command in linux
To list all zero-length files, use this command:
# find . -empty -exec ls {} \;
Find all files owned by user “root” under /var
# find /var -user root
Find all files in group “users” under /var
# find /var -group users
Size can be specified in blocks, bytes, works, Kilobytes, Megabytes or Gigabytes (bcwkMG).
Find all files in your home directory exactly 100 bytes long:
# find $HOME -size 100c
Find all files in your home directory smaller than 100 bytes:
# find $HOME -size -100c
Find all files in your home directory larger than 100MB:
# find $HOME -size +100M
Find all files in your root directory that are SUID.
# find / -xdev -type f -perm +4000
Find all files in your root directory that are SUID-root.
# find / -xdev -type f -user root -perm +4000
Find all files in your home directory with a hard link count of two:
# find $HOME -type f -links 2
Find all files in your home directory with more than one hard link:
# find $HOME -type f -links +1