What Is a File Ending in ~ (Tilde)?
You found a file whose name ends in a tilde — like notes.txt~ — sitting next to your real file. It is a backup your text editor saved. Here is what is inside it, how to open it, and whether you can delete it.
What a file ending in ~ is
A file whose name ends in a tilde, such as notes.txt~, is an automatic backup created by a text editor. When you save notes.txt, the editor first copies the previous version to notes.txt~ so you can fall back to it. It is a plain copy of your file's earlier contents — nothing is encoded or compressed.
Which programs make it
Emacs is the classic source: by default it writes a file~ backup the first time you save in a session. gedit, nano (with backups on), Kate and several Linux editors do the same. Vim normally uses .swp instead, but with set backup it also writes a ~ file.
How to open it
It is just text, so open it in any editor: emacs notes.txt~, nano notes.txt~, or drag it into VS Code. On Windows you can rename it to remove the ~ (or add .txt) and double-click. The contents are the version of the file from before your last save — useful if you need to recover something you overwrote.
Is it safe to delete?
Yes. The ~ file is only a backup of the previous save; deleting it does not touch your real file. Remove it once you are sure you do not need the older version. The editor will create a fresh one next time you save.
How to stop them appearing
In Emacs add (setq make-backup-files nil) to your config, or send them to one folder with (setq backup-directory-alist '((".*" . "~/.emacs-backups/"))). In gedit, turn off Create a backup copy of files before saving in Preferences.
Common mix-up
A leading tilde like ~/notes.txt is different — there the ~ is a shell shortcut for your home folder, not part of the name. The backup file has the tilde at the end.
FAQ
What is a file ending in ~?
It is an automatic backup of the previous version of your file, created by a text editor like Emacs, gedit or nano when you save.
How do I open a file ending in ~?
Open it in any text editor (for example emacs notes.txt~ or nano notes.txt~), or rename it to remove the tilde and open it normally. It is plain text.
Is it safe to delete a ~ backup file?
Yes. It only holds the earlier version of your file, so deleting it does not affect the current file. The editor makes a new backup next time you save.
How do I stop Emacs making ~ files?
Add (setq make-backup-files nil) to your Emacs config, or redirect them to one folder with backup-directory-alist.
Is a ~ at the start the same thing?
No. A leading ~ like ~/notes.txt is a shell shortcut for your home directory. A backup file has the tilde at the end of the name.
Other file types explained
- What Is a .ldb File? (Access Lock File That Will Not Delete)
- What Is a .dwl / .dwl2 File? (AutoCAD Lock File You Can Delete)
- What Is a .idlk File? (InDesign Lock File — Safe to Delete)
- Download Stuck at 100% But Not Finishing — How to Fix It
- .swp vs .swo — What's the Difference? (Vim Swap Files)
- Recover an Unsaved nano File: What the .save File Is & How to Use It
- What Is a .laccdb File? (Access Lock File You Can Delete)
- What Is a .~lock File? (LibreOffice Lock File)