大网数据广告活动
服务器运维问答

How to cd to a folder with two dots in the path

· 52CE 我爱测

I am removing some files on my CentOS server which a virus scan has deemed to be infected. Two of the files have ".." in the path. I understand that normally .. is how we navigate up to the parent directory. In this case the two …

问题原文

原帖链接 · Jack Amoratis · CC BY-SA 3.0

I am removing some files on my CentOS server which a virus scan has deemed to be infected.

Two of the files have ".." in the path. I understand that normally .. is how we navigate up to the parent directory. In this case the two dots seem to be part of the actual path.

For example, if the path of the file is:

/var/lib/mysql/mysql/..\bin\cna12.dll

Then I can cd to:

/var/lib/mysql/mysql/

If I then type cd and press tab twice, I am offered the option to autocomplete to several options. One of the options is:

..\bin\cna12.dll

See it in this pasted text (notice it in the first column):

..\bin\cna12.dll                    help_topic.frm                      slow_log.CSV
columns_priv.frm                    help_topic.MYD                      slow_log.frm
columns_priv.MYD                    help_topic.MYI                      tables_priv.frm

Normally I can type a few characters of the autocomplete suggestions and press tab again to bring the autocomplete to completion... but I can't seem to select it to, uh, complete the autocomplete.

Nothing I do seems to work. Including putting it in quotes such as:

cd "..\bin\"

Note that Linux slashes are this way, "/", while the above cited slashes are Windows style "\".

How do I cd to the bin directory so I can erase that .dll file?

已采纳解答

原帖链接 · prateek61 · CC BY-SA 3.0

I don't believe that is an actual directory, I suspect that that is just a file with backslashes. Try deleting that file directly and it should be removed.

This will work: rm '..\lib\plugin\amd.dll'

I am also not sure how smart cd is on a CentOS system, it might only show autocomplete options for directories only. In which you would have to do rmdir '..\lib\plugin\amd.dll' (assuming it is empty). You can determine this by running ls -l in the /var/lib/mysql/mysql/ directory and seeing if that is a file or a directory and then issue the correct command accordingly.

On a Linux system the backslahes are just treated as characters in the file name and not directory separators. Therefore there is no special distinction when using them in the context of directories. Backslashes are typically used as escape characters for special characters.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-04-16)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。