Skip to content

fd

fd is a fast and user-friendly alternative to find.

Delete directories by pattern

fd --type d '\.svn$' /path/to/dir --exec rm -rf {}

Delete files by pattern and older than 60 days

fd --type f '\.mp3$' /records --changed-before 60d --exec rm {}

Big files

fd --size +100M /path

Biggest files

fd --type f /path --exec ls -ls {} | sort -rnk1 | head -30

Directories with mode 777

fd --type d --max-depth 3 --exec sh -c 'test "$(stat -c %a "{}")" = "777" && echo "{}"' /var/www/

Looking pattern in gz archives

fd '\.gz$' /var/log/nginx/ --exec zgrep booter {}

Different user owner

fd --owner '!www-data' /var/www

Search hidden files and directories (ignored by default)

fd -H regexp

Search including files from .gitignore (ignored by default)

fd -I regexp

Create list of files with size and path

fd --type f ./ --exec ls -la {} | awk '{print $5, $9}' > files.txt