2

This question already has an answer here:

Someone who isn't me ran dd if=/dev/zero of=* iflag=fullblock,count_bytes count=200G, so now there's a 200gb file taking up space on my filesystem. Is there a way to delete it without running rm * ?

marked as duplicate by muru, Fabby, X Tian, roaima, jimmij Oct 2 at 11:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    It would seem that just adding double-quotes do the trick rm "*". But be careful, I just tested this, it's not my amazing knowledge :) – guillermo chamorro Sep 20 at 21:27
4

Below I create and then delete a file named "*". The "\" is often called an "escape" by Unix guys as it tells bash to not interpret the next character, use it literally.

[ahill@infprd-sftp01 ~]$ ls -l
total 0
[ahill@infprd-sftp01 ~]$ touch test1
[ahill@infprd-sftp01 ~]$ touch \*
[ahill@infprd-sftp01 ~]$ ls -l
total 0
-rw-rw-r-- 1 ahill ahill 0 Sep 20 16:28 *
-rw-rw-r-- 1 ahill ahill 0 Sep 20 16:28 test1
[ahill@infprd-sftp01 ~]$ rm \*
[ahill@infprd-sftp01 ~]$ ls -l
total 0
-rw-rw-r-- 1 ahill ahill 0 Sep 20 16:28 test1
  • 1
    any of "*", '*' or \* work – ilkkachu Sep 20 at 23:28
  • I am surprised that double quotes work as a variable in double quotes expands... but OK. I like the escape best still as visually, it says to me 'This character right here will be used literally.' Maybe not a big deal in this example, but in a longer string it would put my mind at ease. – Art Hill Sep 20 at 23:34
  • 2
    expands, yes, but doesn't get word-split or used as filename glob. The things that are special in double quotes are dollar signs, backticks, and backslashes. – ilkkachu Sep 20 at 23:36
  • Bash’s manual calls the forms @ilkkachu mentioned quote characters (this includes backslashes). I think of it like lisp quotes – D. Ben Knoble Sep 21 at 13:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.