How can I delete files in terminal fluently?

Try this:

rm -f 2.mp3 blabla.mp3

rm removes files, and -f forces it to (so that it wont stop, asking you if you want to delete the file). If this not in your home directory, prepend sudo. Here is another way that might require less typing (a bit harder to read though)

rm -f {2,blabla}.mp3

This expands to 2.mp3 blabla.mp3. If you want to use larger filenames, you can use the wildcard character (*), which will return all items starting/ending with the filename you chose. For example:

rm -f bla*

will remove all files starting with bla. If you used this:

rm -f *.mp3

It will remove all files ending with .mp3. If you used this:

rm -f bla*.mp3

It will remove all files starting with bla and ending with .mp3. Possibilities are nearly endless with the * character :P


Just as everyone says, rm -f <file> is the way to go, however, as stonedsquirrel said, you can type the first few letters and hit <TAB> and it will autofill the file name.

Tags:

Command Line