Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bash delete files whose filename contain asterisks

How can one in bash delete files whose filename contain asterisks? I mean, using wildcards. If I do

rm -fr *filter*

I will delete all files in which the word "filter" appears in the filename, but what when the files do contain asterisk?

EDIT: Following your advice, I am not able to delete this

*filter*xyz*.data
like image 876
Open the way Avatar asked Jul 16 '11 17:07

Open the way


People also ask

How do I delete an asterisk file?

Deleting files of a certain file type odt - simply enter the command “rm” followed by an asterisk and the file type.

What is * at end of filename in Linux?

It means the file is executable.

What command is used to remove files * 1 point?

Use the rm command to remove files you no longer need. The rm command removes the entries for a specified file, group of files, or certain select files from a list within a directory. User confirmation, read permission, and write permission are not required before a file is removed when you use the rm command.


1 Answers

rm -rf \*filter\* or rm -rf '*filter*'

like image 64
Paul Tomblin Avatar answered Sep 28 '22 16:09

Paul Tomblin