I’m making a post about this because I ran into this today and I couldn’t remember how to rename a file starting with — (two or double hyphens) in Linux (e.g. –index.html). The customer has obviously used a Windows FTP client to rename index.html to –index.html so it is out of their way, and now me, the server administrator or company sysadmin, has come along with my migration script to relocate it and it has fallen over, crashed, and burned!
When you try and rename it the following is given:
$ mv ––index.html index.html.renamed
mv: unrecognized option `––index.html’
Try `mv ––help’ for more information.
I also tried delimiting it the normal way, but it wouldn’t work either:
mv \–\–index.html index.html.renamed
The correct way to rename it is:
mv ./––index.html index.html.renamed
Because –– has special meaning, you can’t delimit it with a simple backslash (\), you have to put a path reference in there to delimit it. So my path working directory (pwd) was /home/user/data/ where the file was located, so I could use ./ to reference the current pwd. The other option is to put the full path in:
mv /home/user/data/––index.html index.html.renamed
Hopefully this helps out some other Linux server administrator out there who’s mind it has slipped.
- apf: command not found
- Error message “The file is either corrupted or does not have the latest credentials associated with recovery service. (ID: 34513) “
- Automatically Clean Up Temporary ASP.NET Files
- Modifying cPanel Mailbox Quota Errors “invalid maildirsize file”
- Locking down and securing SSH access to your server
- Moving From No Control Panel Servers to a cPanel Server
- Restore SQL Azure Backup to MSSQL Server
- ISAPI Filter ‘C:\Windows\Microsoft.NET\Framework\v4.0.30319\\aspnet_filter.dll’ could not be loaded due to a configuration problem