LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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-29-2012, 01:53 PM   #1
Rohant
Member
 
Registered: Oct 2011
Location: India, Mumbai
Distribution: RHEL, Fedora,Ubuntu, Centos, Windows XP & Windows 7
Posts: 44

Rep: Reputation: Disabled
Unhappy How to Recover File deleted with ' rm -rf ' command.


Hi Friends,

I am new to Linux & was working on my notes in vmware. but accidentally my system shutdown and my vim got closed. when system reboot i was taking my closed vim file back up accidentally i deleted the main file named "nis-server-configuration" with 'rm -rf' command but still one copy of file is present in ".nis-server-configuration.swp" in my swap space.

i tired to open ".nis-server-configuration.swp" with vim but it not in perfect order.

Please anyone give me idea how to recover file which is ".nis-server-configuration.swp" also plz guide me how to recover the file which we delete from rm -rf command.

Thanks,
Rohan
 
Old 07-29-2012, 02:31 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Configure VMWare to add external media to the guest (external USB stick, floppy image, SAMBA share if you can have it networked) and configure the guest to boot from a Live CD like KNOPPIX or Helix 2008R1 (no need to burn it, just the ISO should do). Don't mount the guest's partitions but just point testdisk to the partition containing the deleted files after reading some basic instructions. Save the file to your external media.
 
1 members found this post helpful.
Old 07-29-2012, 04:35 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
*.swp is vim's backup file.
you could try
Code:
# -r = recover
vim -r nis-server-configuration
you might get lucky
Quote:
-r {file} Recovery mode. The swap file is used to recover a crashed
editing session. The swap file is a file with the same
filename as the text file with ".swp" appended. See ":help
recovery".
from 'man vim'
 
1 members found this post helpful.
Old 07-29-2012, 06:59 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
A vi .swap file only stores changes.
Recovery mode expects the original to be there.
 
1 members found this post helpful.
Old 08-19-2012, 01:39 PM   #5
Rohant
Member
 
Registered: Oct 2011
Location: India, Mumbai
Distribution: RHEL, Fedora,Ubuntu, Centos, Windows XP & Windows 7
Posts: 44

Original Poster
Rep: Reputation: Disabled
Thank you guys... i recovered my note file. thanks again...
 
  


Reply



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
How to Recover Deleted Files when rm command was used (I recovered using ext3grep) rtoney5 Linux - Software 8 01-14-2013 05:19 AM
[SOLVED] Help, I deleted a file. How do I recover it? coolgreen1 Linux - General 10 11-22-2010 03:39 PM
Trying to recover a deleted file. mckinnon81 Linux - Newbie 1 05-02-2010 10:56 PM
I have deleted a file thru rm can i recover it ricka343 Linux - General 2 06-27-2006 03:28 AM
How to recover deleted file v1nc3nt Linux - Newbie 5 05-23-2006 03:28 AM

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

All times are GMT -5. The time now is 09:48 PM.

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
Open Source Consulting | Domain Registration