{"id":9397,"date":"2021-08-17T13:23:42","date_gmt":"2021-08-17T13:23:42","guid":{"rendered":"https:\/\/linuxways.net\/?p=9397"},"modified":"2021-08-17T13:23:42","modified_gmt":"2021-08-17T13:23:42","slug":"how-to-restore-a-deleted-file-on-linux","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/mint\/how-to-restore-a-deleted-file-on-linux\/","title":{"rendered":"How to Restore a Deleted File on Linux"},"content":{"rendered":"<h2>What is TestDisk?<\/h2>\n<p>Everybody has accidentally deleted some files while working once or twice in their life. That is why it is important to know the proper tools and procedures to recover files.<\/p>\n<p>TestDisk is a command-line data recovery tool, its functionality extends to the recovery of deleted\/corrupt files, partitions, and filesystems. It also supports boot sector recovery with the help of data backup. Despite its vast functionalities, this tool is easy to use.<\/p>\n<p>In this article, you will learn about TestDisk and how to use it to recover a deleted file in a Linux system.<\/p>\n<p><strong>Note<\/strong>: Linux usually has two options for removing any file. One is the \u201cmove to trash\u201d option while the other is \u201cdelete\u201d. If you have removed the file by placing them in the trash, you can simply recover them from the trash. But if you have used the &#8220;delete&#8221; option to remove the file, the recovery process becomes complicated. So it is recommended practice to use the \u201cmove to trash\u201d option while removing any file.<\/p>\n<h2>Prerequisites<\/h2>\n<p>Linux-based system<\/p>\n<p>Terminal access<\/p>\n<p>A user account with sudo privileges.<\/p>\n<p><strong>Note:<\/strong> These instructions in this tutorial are performed on the Linux Mint system. The TestDisk is valid for any Linux-based system.<\/p>\n<h2>How to Install TestDisk?<\/h2>\n<p>To install the TestDisk through its apt package, run the following command in the terminal.<\/p>\n<pre>sudo apt install testdisk<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1124\" height=\"487\" class=\"wp-image-9398\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-360.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-360.png 1124w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-360-300x130.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-360-1024x444.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-360-768x333.png 768w\" sizes=\"auto, (max-width: 1124px) 100vw, 1124px\" \/><\/p>\n<p>Now, type TestDisk in Terminal to open the tool and authenticate by providing a password when prompted.<\/p>\n<h2>Restore Deleted Files Using TestDisk<\/h2>\n<p>When you start the TestDisk tool, you will be prompted to choose a logging method. It is recommended to choose the create or append option. Once you have selected your option, simply press <strong>Enter <\/strong>to proceed forward.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1044\" height=\"564\" class=\"wp-image-9399\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-361.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-361.png 1044w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-361-300x162.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-361-1024x553.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-361-768x415.png 768w\" sizes=\"auto, (max-width: 1044px) 100vw, 1044px\" \/><\/p>\n<p>Next, you will be prompted to choose the partition or device from which you wish to recover the files. TestDisk will detect your partition by default. Once you have selected your partition you can proceed forward by pressing <strong>Enter.<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1029\" height=\"815\" class=\"wp-image-9400\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-362.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-362.png 1029w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-362-300x238.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-362-1024x811.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-362-768x608.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-362-150x120.png 150w\" sizes=\"auto, (max-width: 1029px) 100vw, 1029px\" \/><\/p>\n<p>Similarly, you have to select your partition table type and proceed forward.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"952\" height=\"639\" class=\"wp-image-9401\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-363.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-363.png 952w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-363-300x201.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-363-768x515.png 768w\" sizes=\"auto, (max-width: 952px) 100vw, 952px\" \/><\/p>\n<p>On the next prompt screen, select <strong>Advanced <\/strong>from the menu.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"984\" height=\"577\" class=\"wp-image-9402\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-364.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-364.png 984w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-364-300x176.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-364-768x450.png 768w\" sizes=\"auto, (max-width: 984px) 100vw, 984px\" \/><\/p>\n<p>Next, select <strong>L Linux <\/strong>on the prompt. And Select the <strong>List<\/strong> option from the menu and hit <strong>Enter.<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"881\" height=\"822\" class=\"wp-image-9403\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-365.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-365.png 881w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-365-300x280.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-365-768x717.png 768w\" sizes=\"auto, (max-width: 881px) 100vw, 881px\" \/><\/p>\n<p>Now navigate to the folder where the file was deleted.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1456\" height=\"822\" class=\"wp-image-9404\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-366.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-366.png 1456w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-366-300x169.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-366-1024x578.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-366-768x434.png 768w\" sizes=\"auto, (max-width: 1456px) 100vw, 1456px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1452\" height=\"825\" class=\"wp-image-9405\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-367.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-367.png 1452w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-367-300x170.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-367-1024x582.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-367-768x436.png 768w\" sizes=\"auto, (max-width: 1452px) 100vw, 1452px\" \/><\/p>\n<p>Once you have reached the folder, you will see that deleted files are flagged by red color.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1456\" height=\"825\" class=\"wp-image-9406\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-368.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-368.png 1456w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-368-300x170.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-368-1024x580.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-368-768x435.png 768w\" sizes=\"auto, (max-width: 1456px) 100vw, 1456px\" \/><\/p>\n<p>Navigate towards the file that you want to recover and Press <strong>c<\/strong> to copy the file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1453\" height=\"824\" class=\"wp-image-9407\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-369.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-369.png 1453w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-369-300x170.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-369-1024x581.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-369-768x436.png 768w\" sizes=\"auto, (max-width: 1453px) 100vw, 1453px\" \/><\/p>\n<p>Once you have selected the file, you will be asked to select and navigate to the destination in the filesystem where you want to place the recovered file.<\/p>\n<p>Once you have done that, simply press <strong>C <\/strong>to paste the recovered file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1458\" height=\"821\" class=\"wp-image-9408\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-370.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-370.png 1458w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-370-300x169.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-370-1024x577.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-370-768x432.png 768w\" sizes=\"auto, (max-width: 1458px) 100vw, 1458px\" \/><\/p>\n<p><strong>Note: <\/strong>The <strong>c<\/strong> and <strong>C <\/strong>in the above two steps are case-sensitive.<\/p>\n<h2>Conclusion<\/h2>\n<p>Deleting files is unavoidable as everyone likes to work in a decluttered and organized system. But if you accidentally deleted an important file, avoid panic and Use this article to recover the file in a few minutes using TestDisk.<\/p>","protected":false},"excerpt":{"rendered":"<p>What is TestDisk? Everybody has accidentally deleted some files while working once or twice in their life. That is why it is important to know the proper tools&hellip;<\/p>","protected":false},"author":1,"featured_media":9443,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[491,195],"class_list":["post-9397","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mint","tag-delete","tag-restore"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9397","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=9397"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9397\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/9443"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=9397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=9397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=9397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}