Skip to content

Instantly share code, notes, and snippets.

@BeanBagKing
Last active April 24, 2021 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save BeanBagKing/54a07c6a9e5a589c6020c401be6131cb to your computer and use it in GitHub Desktop.
Save BeanBagKing/54a07c6a9e5a589c6020c401be6131cb to your computer and use it in GitHub Desktop.
Hunting One Liners
# Linux - Look for attempts to hide files (note the spaces)
find / \( -name '. ' -o -name '.. ' -o -name '...' -o -name ' ' \)
# Linux - Find last 20 modified files
### Excluded directoreis for /proc, /sys
### Excludes /tmp/sort* as these are used by this process
##### Exclude directory - find . -type d \( -path dir1 -o -path dir2 -o -path dir3 \) -prune -o -print
find / -type d \( -path /proc -o -path /sys \) -prune -o -print -type f ! -wholename "/tmp/sort*" -exec stat --format '%Y :%y %n' "{}" \; | sort -nr | cut -d: -f2- | head
# Find 20 largest files
find / -type f -exec du -Sh {} + | sort -rh | head -n 20
# Find all files larger than * (somewhat sorted by size)
find / -type f -size +10M -exec ls -lh {} \; | sort -k 5 -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment