0

I noticed a file with a .txt~ extension.

  • What does the ~ mean?
  • How can I open this file? It seems not to work with a text editor.
Karlo
  • 105

1 Answers1

5

That's an editor backup file. Many Linux/Unix editors create that when saving the file. It's the same file type as the file without the ~, so you can use the same program (typically an editor) to open it.

Please notice that on Linux filename extensions don't have the strong semantics that they have on Windows; it's more a convention than anything else. .txt is commonly used for text files, but you can give them any extension you like (thus the common README name which on Windows would be README.txt), so foo.txt~ can live peacefully side by side to its newer version foo.txt.

That's also why there is the file command that looks inside a file to classify it: Since there is no filename extension for executable files (unlike foo.exe on Windows), there is no way of knowing what a file foo might be.

Desktop file managers use a MIME type database to classify files by their extensions so they can start the correct application to open them, so it makes sense to follow the convention; but this is not enforced in any way.

HuHa
  • 3,385