LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-09-2019, 08:51 AM   #1
daviddon
LQ Newbie
 
Registered: May 2019
Posts: 16

Rep: Reputation: Disabled
Recover Tilde Ending File


I used mv to rename an important file (an eth1 file with all of the server info) without backing it up. When I typed in the command, I saw a message saying something about swap file and crashing. After that, the content of the file was gone and I saw couple files with the ~ at the end. Does the tilde mean the file was backed up? Can I recover the file?
 
Old 07-09-2019, 11:29 AM   #2
Mark_667
Member
 
Registered: Aug 2005
Location: Manchester, England
Distribution: Ubuntu 19.04
Posts: 356

Rep: Reputation: 27
Try opening the files with ~ at the end of their name in a text editor. What do you get?
 
1 members found this post helpful.
Old 07-09-2019, 11:44 AM   #3
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,814
Blog Entries: 15

Rep: Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661
I've seen Gvim (on MS Windows) save a backup of a file automatically with "~" at the end of the file name while it was editing. Is your edit session still open by chance? If so in that you could write to a separate file name.

If not, and, were it me, I'd copy that "~" suffixed file to another name completely then vi that separate name to avoid possibly overwriting it.

In general vim/vi would create the file with .swp at end of name and . at the start. If you have a .swp you can use vi -r (or vim -r) to recover what is in that .swp file. Usually if such a file exists vi/vim automatically detect it and tell you about it.
 
1 members found this post helpful.
Old 07-09-2019, 01:02 PM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,050
Blog Entries: 13

Rep: Reputation: 3498Reputation: 3498Reputation: 3498Reputation: 3498Reputation: 3498Reputation: 3498Reputation: 3498Reputation: 3498Reputation: 3498Reputation: 3498Reputation: 3498
Emacs makes temporary files with that extension. Yes. Check that file out and you can just rename it to what you want to be able to retain it. Meanwhile, it should not be going away until you open a new editor session and start making changes on the same-named original (without the tilde ending that is)

Consider configuring your editor to formally make backup files and put them into a common directory. This is what I do and it allows me to keep some number of backups, I think I chose either three or five just to protect myself, from ... myself
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tilde / back-tick key not giving me a tilde or back-tic. Ubuntu 10.04 on Macbook Pro BrianK Linux - Laptop and Netbook 3 09-01-2015 09:14 PM
"file open" common dialog box slow to populate file list if file starts with tilde eaberry Linux - Desktop 1 02-04-2013 01:03 PM
[SOLVED] Redirect tilde addresses to non-tilde Cyrolancer Linux - Server 11 01-09-2013 04:25 AM
File name followed by a tilde ~ malikah Linux - Newbie 2 02-17-2009 04:10 PM
editor saves duplicate file with tilde after it smaudlin Red Hat 2 12-29-2004 04:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration