为什么 `ls -lF` 列出目录中不存在前缀为“~$”的文件?

Why is `ls -lF` listing files with the prefix "~$" not present in the directory?

我目前正在练习 WSL 中的基本 Shell 命令,Windows Linux 的子系统(我没有 linux 系统,但我想熟悉一下使用命令)。

我在命令提示符 window 上启动了一个 bash 会话,然后使用 cd 导航到我的桌面。在桌面上,我注意到在使用 ls -lF 后,会出现一些前缀为 ~$ 的文件,例如:'~$executable.x'*'~$file.txt' 这些文件目前不在桌面目录下,但我记得它们曾经在某个时间点(从一周前到几个月前不等)。 当我在 powershell windows 中执行相同的过程时(不使用 linux 命令)我注意到显示的文件与桌面匹配并且没有列出额外的文件。

我想知道 是否有人可以解释 ~$ 在这种情况下的含义?我的直觉告诉我它们是备份文件,不知何故隐藏在桌面中。谷歌搜索后,我只能找到 ~ reefers to home。我也明白 $ 是 bash shell 在等待我输入内容时的默认提示符号,但我仍然不明白为什么它会显示为名称的前缀一个文件。

希望我把问题说清楚了。 我目前正在阅读 Blum 和 Bresnahan 的 "Linux® Command Line and Shell Scripting BIBLE",但我无法在那里找到答案,这是我在多次谷歌搜索尝试后的最后资源。有关该主题的更多信息的任何其他来源都会有所帮助。

在 Windows 上,以 ~ 开头的文件用于隐藏文件。更具体地说,前缀 ~$ 通常用作程序的备份,如果它们在写入文件更新之前崩溃(例如 Microsoft Word 等)

来自Wikipedia

The tilde symbol is used to prefix hidden temporary files that are created when a document is opened in Windows. For example, when you open a Word document called “Document1.doc,” a file called “~$cument1.doc” is created in the same directory. This file contains information about which user has the file open, to prevent multiple users from attempting to change a document at the same time.

参见:Why does Word make temporary files?

相关超级用户问题:https://superuser.com/questions/405257/what-type-of-file-is-file