TLDRBins TLDRBins / Find


Usage Tips:

  • Click on a keyword to enable inline editing.
  • Click inside a code block to copy (excludes comments).
  • Use the button to view examples.
  • Click outside to collapse all examples.

Locate a file

locate <FILE>
Sample Output: TO-DO

Find files of type file

find . -type f
Sample Output: TO-DO

Find and Open

find / -name <FILE> -exec cat {} \;
Sample Output: TO-DO

Find SUID bit set files

find / -type f -user root \( -perm -4000 -o -perm -2000 \) 2>/dev/null -ls
Sample Output: TO-DO

Find files owned by user

find / -user <USER> -ls 2>/dev/null | grep -v -e " \/proc" -e " \/sys"
Sample Output: TO-DO

Find files owned by group

find / -group <GROUP> 2>/dev/null | grep -v -e ^/proc
Sample Output: TO-DO

Find files created between 1/1/2024 and 31/12/2024

find / -type f -newermt 2024-01-01 ! -newermt 2024-12-31 -ls 2>/dev/null
Sample Output: TO-DO

Find files with capabilities

find / -exec getcap {} \; 2>/dev/null
Sample Output: TO-DO

Find writable folders

find . -type d | while read dir; do mkdir ${dir}/test 2>/dev/null && echo "${dir} - directory create OK" && rmdir ${dir}/test; touch ${dir}/test 2>/dev/null && echo "${dir} - file write OK" && rm ${dir}/test; done
Sample Output: TO-DO

Find files not modified by dpkg (i.e. modified by something else)

find /lib -type f -printf "%M %n %-6u %-6g %6s %TY-%Tm-%Td %TT %TZ %h/%f\n" | sort -k 6,7 | grep -v ".0000000000"
Sample Output: TO-DO