file name beginning with -

General support questions
Post Reply
marksv
Posts: 3
Joined: 2020/02/08 21:24:11

file name beginning with -

Post by marksv » 2020/02/08 21:56:44

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 203 times

User avatar
TrevorH
Forum Moderator
Posts: 28095
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: file name beginning with -

Post by TrevorH » 2020/02/08 23:40:40

Use tab to do filename completion - perhaps there is a trailing space on the filename that you can't see.

rm -- -a<tab>
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

marksv
Posts: 3
Joined: 2020/02/08 21:24:11

Re: file name beginning with -

Post by marksv » 2020/02/09 00:03:00

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 198 times

User avatar
TrevorH
Forum Moderator
Posts: 28095
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: file name beginning with -

Post by TrevorH » 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.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

marksv
Posts: 3
Joined: 2020/02/08 21:24:11

Re: file name beginning with -

Post by marksv » 2020/02/09 00:40:22

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.

Post Reply

Return to “CentOS 7 - General Support”