DEV Community

loading...

Discussion on: Deleting Files and Directories in Linux System

Collapse
sfjuocekr profile image
Sjoer van der Ploeg

Please add [] bracket explanation as well?

rm file[123]

Collapse
yashsugandh profile image
yash sugandh Author

Hey Sjoer van der Ploeg,

Let's take an example

  • remove all the files that start with "file" and has exactly one character after that 1, 2 or 3

rm-file-wildcard-bracket

In the above example, we used wildcard [] and created command rm file[123] where

rm represents remove command
file represents the text "file" in the filename
[123] represents exactly one character out of values 1, 2 or 3

If you still have any queries related to wildcards please look at the previous post on Wildcards(*,?,[],[[:class:]]) for better understanding.