restore deleted file on linuxos

TestDisk is a powerful data recovery tool that can be used to recover deleted files on Linux. Here’s how to use TestDisk to restore a deleted file:

  1. Install TestDisk: You can install TestDisk on your Linux system using your distribution’s package manager. For example, on Ubuntu, you can run the command sudo apt-get install testdisk to install it.

  2. Launch TestDisk: You can launch TestDisk from the terminal by running the command sudo testdisk. This will launch a text-based user interface.

  3. Select the disk: Use the arrow keys to select the disk that contains the deleted file and press Enter.

  4. Select the partition: Select the partition on which the deleted file was located and press Enter.

  5. Choose “Advanced”: On the next screen, select “Advanced” and press Enter.

  6. Select the file system: Select the file system used by the partition (e.g., ext4, NTFS, etc.) and press Enter.

  7. Select the partition table type: Select the partition table type used by the disk (e.g., Intel, EFI GPT, etc.) and press Enter.

  8. Analyze the partition: On the next screen, select “Analyse” and press Enter. This will analyze the partition and display any partitions or files that can be recovered.

  9. Select the deleted file: Use the arrow keys to navigate to the deleted file and press the “c” key to copy it to a new location. You will be prompted to select a destination directory.

  10. Quit TestDisk: Once the file has been recovered, you can quit TestDisk by selecting “Quit” and pressing Enter.

Note that TestDisk can recover deleted files only if the data has not been overwritten. If the file has been partially overwritten, TestDisk may not be able to recover it completely.

For example,

here’s an example of how to use TestDisk to recover a deleted file on a Linux system:

  1. Launch TestDisk: Open a terminal and type sudo testdisk to launch TestDisk with root privileges.

  2. Select the disk: Use the arrow keys to select the disk that contains the deleted file and press Enter.

  3. Select the partition: Select the partition on which the deleted file was located and press Enter.

  4. Choose “Advanced”: On the next screen, select “Advanced” and press Enter.

  5. Select the file system: Select the file system used by the partition (e.g., ext4, NTFS, etc.) and press Enter.

  6. Select the partition table type: Select the partition table type used by the disk (e.g., Intel, EFI GPT, etc.) and press Enter.

  7. Analyze the partition: On the next screen, select “Analyse” and press Enter. This will analyze the partition and display any partitions or files that can be recovered.

  8. Select the deleted file: Use the arrow keys to navigate to the deleted file and press the “c” key to copy it to a new location. You will be prompted to select a destination directory.

For example, let’s say we have a file named “important_document.txt” that was deleted from the home directory of the user “johndoe” on an ext4 file system. We want to recover this file using TestDisk.

  1. Launch TestDisk: Open a terminal and type sudo testdisk to launch TestDisk with root privileges.

  2. Select the disk: Select the disk that contains the home directory of the user “johndoe”.

  3. Select the partition: Select the partition that contains the home directory of the user “johndoe”.

  4. Choose “Advanced”: On the next screen, select “Advanced”.

  5. Select the file system: Select “ext4”.

  6. Select the partition table type: Select the partition table type used by the disk.

  7. Analyze the partition: On the next screen, select “Analyse”.

  8. Select the deleted file: Use the arrow keys to navigate to the deleted file “important_document.txt” and press the “c” key to copy it to a new location. For example, you can copy it to the Desktop directory.

Once TestDisk has finished copying the file, you can close TestDisk and check the new location to ensure that the recovered file is intact.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值