How to find and delete files in Linux

Using the find command in Linux you can search for file names matching a specific pattern and optional delete them.

Find all files ending in pdf.1 at and below the current directory

find . -name "*.pdf.1" -type f

Delete all files ending in pdf.1 at and below the current directory

find . -name "*.pdf.1" -type f -delete

Justin Kelly

Justin Kelly

Web Developer, Business Analytics, Data Engineer specialising in PHP and Tableau

Based in Melbourne, Australia

Feel free to contact me justin@kelly.org.au or _justin_kelly

Leave a comment

Name Notify me of replies by email.