Skip to content

Instantly share code, notes, and snippets.

@wikiti
Last active October 19, 2018 10:45
Show Gist options
  • Save wikiti/6e576c8e7cc34d1dc1be5bc08d890633 to your computer and use it in GitHub Desktop.
Save wikiti/6e576c8e7cc34d1dc1be5bc08d890633 to your computer and use it in GitHub Desktop.
Use find command to search and delete/remove files by name (globs). This can be useful to remove temporary files.
# Find files by name
find path/to/folder -name <name or pattern>
# Find files and remove by name
find path/to/folder -name <name or pattern> -exec rm {} \;
# Examples
find ~/secrets -name super_secret.txt
find ~/images -name *.png
find ./ -name *.orig*
find ./ -name *.orig* -exec rm {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment