LinuxQuestions.org
Register a domain and help support LQ
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, 02: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, 03:31 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
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, 05:35 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
*.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, 07:59 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
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, 02: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


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


All times are GMT -5. The time now is 09:00 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration