Page 1 of 1

file name beginning with -

Posted: 2020/02/08 21:56:44
by marksv
Not sure what's going on here so I thought I'd ask if anyone has seen something like this.

Running ownCloud 10.x on a CentOS 7 VM in ESXi 6.5. Been running fine for a couple a couple of years. Started acting up yesterday so I logged in. Turns out I had run out of disk space but this is not related to that.

While I was cleaning things up, etc I consoled in using root. When I ls root the below showed up. There is a file named -a and a directory named -p. figured out I should be able to access them by using a command then ./-a etc. However the system reports no such file or directory. I created a file named -v and was able to operate on the file using ./-v. Have another CentOS 7 VM running Axigen. Checked that instance and don't have those files. None of the other user accounts on either machine has anything like that. Looked around in logs, etc nothing obvious.
Screen Shot 2020-02-08 at 4.28.01 PM.png
Screen Shot 2020-02-08 at 4.28.01 PM.png (57.84 KiB) Viewed 349 times

Re: file name beginning with -

Posted: 2020/02/08 23:40:40
by TrevorH
Use tab to do filename completion - perhaps there is a trailing space on the filename that you can't see.

rm -- -a<tab>

Re: file name beginning with -

Posted: 2020/02/09 00:03:00
by marksv
Thanks for the idea, but no luck. When I hit tab the cursor stays in the same position and hitting enter gives the same error. If I create a file with a -, say -b it has the same attributes as the -a file. I can operate on -b no problem with properly formatted statements. If I use those same statements and change b to a I get the no such file or directory error.
Screen Shot 2020-02-08 at 6.59.39 PM.png
Screen Shot 2020-02-08 at 6.59.39 PM.png (12.57 KiB) Viewed 344 times

Re: file name beginning with -

Posted: 2020/02/09 00:13:28
by TrevorH
Cut and paste the filename. Maybe it's not a - but something like an m-dash. Or if it is a minus then do rm -- -<tab><tab> and see if it is one of the files it lists as a possible completion.

Re: file name beginning with -

Posted: 2020/02/09 00:40:22
by marksv
TrevorH wrote:
2020/02/09 00:13:28
Cut and paste the filename. Maybe it's not a - but something like an m-dash. Or if it is a minus then do rm -- -<tab><tab> and see if it is one of the files it lists as a possible completion.
Thanks. Copy paste was the solution. How easily the eye can be fooled.