Search code examples
linuxrm

How to remove special character filename in Linux?


I have a filename with -v. I try to remove it by

rm -v or rm "-v" or rm ¥-v

But it shows something like

rm: missing operand
Try 'rm --help' for more information.

Solution

  • I have a filename with -v

    Try:

    rm -- '-v'
    

    If you need to use rm option like verbose for example, try:

    rm -v -- '-v'
    

    -- tells SHELL it's the end of options. And disables further option processing. So anything after -- will be treated as filenames.