Skip to content

Instantly share code, notes, and snippets.

@kekneus373
Created January 12, 2026 21:24
Show Gist options
  • Select an option

  • Save kekneus373/379c263265b01c69acc9b78235bb4670 to your computer and use it in GitHub Desktop.

Select an option

Save kekneus373/379c263265b01c69acc9b78235bb4670 to your computer and use it in GitHub Desktop.
Recursively find and remove files by extension in Linux

To find and remove files by extension in a directory and its subdirectories on Linux, you can use the command: find /path/to/dir -name "*.extension" -type f -delete, replacing /path/to/dir with your directory path and *.extension with the specific file extension you want to delete. For example, to remove all .txt files, use find /path/to/dir -name "*.txt" -type f -delete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment