# RecoverPy | Tool to Find and Recover Deleted or Overwritten Files From Terminal

**URL:** <https://onehack.st/t/recoverpy-tool-to-find-and-recover-deleted-or-overwritten-files-from-terminal/213892>\
**Category:** Tools & Scripts\
**Tags:** tools, data-recovery\
**Created:** [February 6, 2022, 11:27am UTC](https://onehack.st/t/recoverpy-tool-to-find-and-recover-deleted-or-overwritten-files-from-terminal/213892 "2022-02-06T11:27:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheStrength](https://onehack.st/user_avatar/onehack.st/thestrength/32/46753_2.png) [@TheStrength](https://onehack.st/u/TheStrength)\
**Post date:** [February 6, 2022, 11:27am UTC](https://onehack.st/t/recoverpy-tool-to-find-and-recover-deleted-or-overwritten-files-from-terminal/213892/1 "2022-02-06T11:27:18Z")

</div>

![image](https://onehack.st/uploads/default/original/3X/3/0/30b3c90ffb9f5e2a17f5f1f196713840933b7a27.png)

_Recover overwritten or deleted data._

[![Release](https://camo.githubusercontent.com/f5f22a8d20bf688af9985e7e1caddbe743bbff3168d91c427fca5be1293edefa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7061626c6f6c65632f7265636f7665727079) ](https://img.shields.io/github/v/release/pablolec/recoverpy)[![License](https://camo.githubusercontent.com/b44c1fcb95c8f87fb5fa4967ac60cb589d0f4cb155852c80b199f6edb771b4ce/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7061626c6f6c65632f7265636f7665727079) ](https://github.com/PabloLec/recoverpy/blob/main/LICENSE)[![Downloads](https://camo.githubusercontent.com/eaa741dfe3c6fe1d1f407de2f362a2f0b8babbfa3a8075474b9172aa35336871/68747470733a2f2f7374617469632e706570792e746563682f706572736f6e616c697a65642d62616467652f7265636f76657270793f706572696f643d746f74616c26756e6974733d616262726576696174696f6e266c6566745f636f6c6f723d677265792672696768745f636f6c6f723d726564266c6566745f746578743d646f776e6c6f616473) ](https://pepy.tech/project/recoverpy)[![Tests](https://github.com/PabloLec/recoverpy/actions/workflows/recoverpy-tests.yml/badge.svg?branch=main)](https://github.com/PabloLec/RecoverPy#)

- [Demo](https://github.com/PabloLec/RecoverPy#Demo)
- [Installation](https://github.com/PabloLec/RecoverPy#Installation)
  - [Dependancies](https://github.com/PabloLec/RecoverPy#arrow_right-dependancies)
  - [Installation from pip](https://github.com/PabloLec/RecoverPy#arrow_right-installation-from-pip)

- [Usage](https://github.com/PabloLec/RecoverPy#Usage)
- [Tips](https://github.com/PabloLec/RecoverPy#Tips)
- [Contributing](https://github.com/PabloLec/RecoverPy#Contributing)

# RecoverPy

You can already find plenty of solutions to recover deleted files, but it can be a hassle to recover overwritten files. RecoverPy searches through every block of your partition to find your request.

## Demo

[![](https://github.com/PabloLec/RecoverPy/raw/main/docs/assets/demo.gif)](https://github.com/PabloLec/RecoverPy/blob/main/docs/assets/demo.gif)

## Installation

🐧 RecoverPy is currently only available on Linux systems.

#### ➡ Dependancies

**Mandatory:** To list and search through your partitions, recoverpy uses `grep`, `dd`, and `lsblk` commands.

**Optional:** To display real time grep progress, you can install `progress`.

To install all dependencies:

- Debian-like: `apt install grep coreutils util-linux progress`
- Arch: `pacman -S grep coreutils util-linux progress`
- Fedora: `dnf install grep coreutils util-linux progress`

#### ➡ Installation from pip

`python3 -m pip install recoverpy`

## Usage

python3 -m recoverpy

🔴 **You must have root access to use recoverpy**.

_If you are not logged as root use `sudo recoverpy` or log in with `su -` before execution._

1️⃣ **Select the system partition** in which your file was. If you are out of luck, you can alternatively search in your home partition, maybe your IDE, text editor, etc. made a backup at some point.

2️⃣ **Type a text string to search**. See tips below for better results.

Note that searching a string in a whole partition may take _a while_. (see [euphemism](https://en.wikipedia.org/wiki/Euphemism))

Default save path is `/tmp/`, click on Settings to edit configuration.

3️⃣ **Start search** , Results will appear in the left-hand box.

4️⃣ **Select a result** to display the corresponding partition block content in the right-hand box.

5️⃣ Once you have found your precious, **select `Save`**.

6️⃣ You can now either save this block individually or explore neighboring blocks for the remaining parts of the file. You could then save it all in one file.

## Tips

- Always do backups! Yes, maybe too late…
- **Unmount your partition before you do anything!** Although you can search with your partition still mounted, it is highly recommended to unmount your partition to avoid any alteration to your file.

Regarding the searched string:

- Be concise, find something that could be unique to your file.
- Stay simple, your string is escaped but exotic characters may affect your results.
- Try to remember the last edit you have made to your file.

When you found your file:

- Use the option to explore neighboring blocks to make sure you do not miss some part of your file.

## Contributing

Thank you for considering contributing to RecoverPy. Any request, bug report or PR are welcome. Please read the [contributing guide](https://github.com/PabloLec/RecoverPy/blob/main/CONTRIBUTING.md).

## GitHub:

> **[GitHub - PabloLec/RecoverPy: Interactively find and recover deleted or...](https://github.com/PabloLec/RecoverPy)**
>
> Interactively find and recover deleted or :point\_right: overwritten :point\_left: files from your terminal
