Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
"touch - " created a file '-',
now how to delete this file,
as "rm -options - " is not accepted.
Thanks from gping

From the man page on rm, you need to use 2 "-" characters.
NOTES
A -- permits the user to mark explicitly the end of any command line options, allowing rm to recognize file arguments that begin with a -. As an aid to BSD migration, rm will accept - as a synonym for --. This migration aid may disappear in a future release. If a -- and a - both appear on the same command line, the second will be interpreted as file.

Deleting file "-" is little tricky in Solaris since the dash is confusing the rm command because it seems that you will provide a flag.
these are the steps to take deleting file like that.
1) #ls -il -
the command will get the inode of the file and the result will look like this
126 wr-xwr-r -- -- - "-"
* note 126 is the inode of the file
2) using find command and the inode
#find /- -inum 126 -exec rm {} \;* after the / include the - because there could be other files that have the same inode in other directories and you dont want to delete them.
I guess that will solve your problem

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |