Saturday, December 23, 2017

Linux: Recovering files deleted using "rm -rf"


Removed python script file by accident. Following two methods worked for me in retrieving the file.

Trick 1:
This was posted on askubuntu.com

$grep -a -B 40 -A 80 'string_from_file' /dev/sda1 > save_here.txt

-A 100 save 80 lines after match
-B 40 save 40 lines before match
string_from_file at least one unique string you remembered from deleted file
save_here.txt    retrieved content is copied here

Trick 2:
$lsof | grep -i "/path/to/file"
progname 1234 user_name 44 8,1 43219876 432890 /path/to/file
$cp /proc/1234/fd/44 /restore/file/tothis/path

Retrieved files might have unnecessary data or few lines might be arranged in reverse order.



2 comments:

  1. Replies


    1. ☑️☑️COMPOSITE CYBER SECURITY SPECIALISTS ☑️☑️

      •• Are you Seeking for the Best Legit Professional Hackers online?
      Congratulations Your search ends right here with us. •• ⚡️⚡️

      ☑️☑️For Years Now We have Been helping companies secure there Infrastructures against malicious Attacks, however private individuals have been making use of our services to provide Optimum solutions to their cyber and Hacking related Issues by providing them unlimited Access to their desired informations from their Target such as Phone Hack (Which enables them to monitor their kids/wife/husband/boyfriend/girlfriend, by gaining access to everything they are doing on their phone without their notice), Credit Card Mishaps, Website Hacking, Funds Recoveries And Every Other Cyber Related Issues That has to Do With HACKING.

      ☑️☑️COMPOSITE CYBER SECURITY SPECIALISTS is a vibrant squad of dedicated online hackers maintaining the highest standards and unparalleled professionalism in every aspect.
      We Are One Of The Leading Hack Teams In The United States With So Much Accolades From The Deep Web And IT Companies. ••
      ••We Offer Varieties Of LEGIT Hacking Services With the Help Of Our Root HackTools, Special HackTools and Our Technical Hacking Strategies Which Surpasses All Other Hackers.

      ☑️ Below Is A Full List Of Our Services:
      ▪️ FUNDS RECOVERY ON SCAM INVESTMENTS, BINARY OPTIONS TRADING and ALL TYPES OF SCAMS.
      ▪️ WEBSITE AND DATABASE HACKING πŸ’»
      ▪️ CREDIT REPAIR. πŸ’³
      ▪️ PHONE HACKING & CLONING (giving you πŸ“± Unnoticeable access to everything Happening on the Target’s Phone)
      ▪️ CLEARING OF CRIMINAL RECORDS ❌
      ▪️ SOCIAL MEDIA ACCOUNTS HACKING πŸ“±
      ▪️RECOVERY OF DELETED FILES πŸ“€
      ▪️LOCATION TRACKING πŸ“Œ
      ▪️BITCOIN MINING ⛏ And lot More.


      ☑️We have a team of seasoned PROFESSIONALS under various skillsets when it comes to online hacking services. Our company in fact houses a separate group of specialists who are productively focussed and established authorities in different platforms. They hail from a proven track record and have cracked even the toughest of barriers to intrude and capture all relevant data needed by our Clients. Some Of These Specialist Includes ⭐️ DAWID CZAGAN⭐️ JACK CABLE ⭐️ SEAN MELIA ⭐️ ARNE SWINNEN ⭐️And More. All you Need To do is To Write us a Mail Then We’ll Assign any of These Hackers To You Instantly.

      ☑️COMPOSITE CYBER SECURITY SPECIALISTS is available for customer care 24/7. Feel Free to Place your Requests.

      ☑️☑️CONTACT:
      ••• Email:
      composite.cybersecurity@protonmail.com

      πŸ”˜2020 © composite cybersecurity specialists
      πŸ”˜Want faster service? Contact us!
      πŸ”˜All Rights Reserved ®️.

      Delete