linux下删除带'-'的文件

不知为什么主目录下忽然多了个-sV文件,目测是由于nmap的-sV参数产生的。
写下来权当作个笔记~shell

如今来模拟下当时的状况code

touch -- -sV
touch ./-sV # 两种都行

如今工做目录底下会产生一个文件名为-sV的文件
若是执行orm

rm -sV

会产生一个错误rem

rm: invalid option -- 's'
Try 'rm --help' for more information.

缘由是无效的参数sit

原本打算Google下看看的,结果rm --help就看到答案了io

To remove a file whose name starts with a '-', for example '-foo',
use one of these commands:
  rm -- -foo

  rm ./-foo
相关文章
相关标签/搜索