Remove multiple files

Tabela de Conteúdo

Sometimes, I need to delete multiple gigantic files (usually logs) at once and the following message is generated

/bin/rm Argument list too long

So what to do?

Just enter the directory where the files are found and run some command alternatives

To delete all files containing “2023” in your name:

    $ for a in *2023*; do rm $a; done

To delete all files that have the log extension

    $ for a in *.log; do rm $a; done

Easy peasy! :)