{"id":15161,"date":"2022-02-15T08:50:08","date_gmt":"2022-02-15T08:50:08","guid":{"rendered":"https:\/\/linuxways.net\/?p=15161"},"modified":"2022-02-15T08:50:08","modified_gmt":"2022-02-15T08:50:08","slug":"how-to-recover-deleted-data-on-a-linux-system","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/how-to-recover-deleted-data-on-a-linux-system\/","title":{"rendered":"How to Recover Deleted Data on a Linux System"},"content":{"rendered":"<p>Loss of data is one of the most stressful and painful experiences a user can have. The fear of never being able to recover valuable data once it has been erased or lost causes worry and leaves consumers powerless. But don&#8217;t take tension; there are some software and ways available that help you recover deleted files on your Linux workstations. We will provide a better solution to this data loss problem in this Article on Ubuntu (Linux Operating System).<\/p>\n<p>The simpler way is to recover it from the &#8220;Trash&#8221; directory using a Graphical User Interface. Another way is by installing Test Disk software through the Command Line Interface.<\/p>\n<h2><strong>Recover Deleted Data on a Linux System<\/strong><\/h2>\n<p>Below two ways are provided to recover data from Ubuntu. You can follow any of the approaches which are appropriate for you.<\/p>\n<h3><strong>Method1: Recover Deleted Data on Ubuntu using Trash directory<\/strong><\/h3>\n<p>Whenever we delete some data on Ubuntu (Linux OS), a copy of that deleted data is saved to the trash folder, so that if we want to recover the data, we can recover it from the Trash directory. Now follow the procedure below.<\/p>\n<h4><strong>Step 1: Open Trash directory<\/strong><\/h4>\n<p>Click on the \u201cTrash\u201d directory.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"890\" height=\"599\" class=\"wp-image-15162\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-364.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-364.png 890w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-364-300x202.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-364-768x517.png 768w\" sizes=\"auto, (max-width: 890px) 100vw, 890px\" \/><\/p>\n<h4><strong>Step 2: Restore the file<\/strong><\/h4>\n<p>Now select the file from the trash directory which you want to recover and click on the \u201cRestore\u201d button, below I am recovering the &#8220;Linux&#8221; folder<strong>.<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"894\" height=\"577\" class=\"wp-image-15163\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-365.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-365.png 894w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-365-300x194.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-365-768x496.png 768w\" sizes=\"auto, (max-width: 894px) 100vw, 894px\" \/><\/p>\n<p>Now the restored file will be removed from the Trash director and stored back from where it is deleted.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"892\" height=\"600\" class=\"wp-image-15164\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-366.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-366.png 892w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-366-300x202.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-366-768x517.png 768w\" sizes=\"auto, (max-width: 892px) 100vw, 892px\" \/><\/p>\n<h3><strong>Method 2: Recover Deleted Data on Ubuntu using Test Disk<\/strong><\/h3>\n<p>Test Disk is one of the useful approaches to the data loss problem. Test Disk is a free and sophisticated data recovery application that rebuilds and restores boot partitions and updates partition tables, among other things. It recovers deleted data from a variety of file systems, including FAT, exFAT, ext3, ext4, and NTFS, to name a few, and copies them to a new spot. One of the characteristics that distinguish Test Disk from other data recovery applications is that it is a Command-Line data retrieval tool.<\/p>\n<h4><strong>Step 1: Update Packages<\/strong><\/h4>\n<p>Before installing any software firstly, you need to update your package list, run the below-mentioned command to update all packages.<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ sudo apt update<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1615\" height=\"871\" class=\"wp-image-15165\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-367.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-367.png 1615w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-367-300x162.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-367-1024x552.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-367-768x414.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-367-1536x828.png 1536w\" sizes=\"auto, (max-width: 1615px) 100vw, 1615px\" \/><\/p>\n<h4><strong>Step 2: Installation of Test Disk Software<\/strong><\/h4>\n<p>Now run the given below command to install the Test Disk recovery software.<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ sudo apt install testdisk<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1504\" height=\"673\" class=\"wp-image-15166\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-368.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-368.png 1504w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-368-300x134.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-368-1024x458.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-368-768x344.png 768w\" sizes=\"auto, (max-width: 1504px) 100vw, 1504px\" \/><\/p>\n<h4><strong>Step 3: Check installation<\/strong><\/h4>\n<p>Write the given below command on the terminal to check that the Test Disk is successfully installed by checking its version.<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ testdisk --version<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1552\" height=\"406\" class=\"wp-image-15167\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-369.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-369.png 1552w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-369-300x78.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-369-1024x268.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-369-768x201.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-369-1536x402.png 1536w\" sizes=\"auto, (max-width: 1552px) 100vw, 1552px\" \/><\/p>\n<h4><strong>Step 4: Recover file using Test Disk<\/strong><\/h4>\n<p>First, open the Test Disk file by the below-mentioned command:<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ sudo testdisk <\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"893\" height=\"310\" class=\"wp-image-15168\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-370.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-370.png 893w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-370-300x104.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-370-768x267.png 768w\" sizes=\"auto, (max-width: 893px) 100vw, 893px\" \/><\/p>\n<p>Now from arrow keys move to the \u201cCreate\u201d option and press Enter.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1372\" height=\"711\" class=\"wp-image-15169\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-371.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-371.png 1372w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-371-300x155.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-371-1024x531.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-371-768x398.png 768w\" sizes=\"auto, (max-width: 1372px) 100vw, 1372px\" \/><\/p>\n<p>Now I want to recover a file from an external USB device \u201cKingston DT 101 G2\u201d connected to my virtual machine so by arrow keys move down to it and then from down options move to \u201cproceed\u201d option and press Enter.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1208\" height=\"768\" class=\"wp-image-15170\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-372.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-372.png 1208w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-372-300x191.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-372-1024x651.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-372-768x488.png 768w\" sizes=\"auto, (max-width: 1208px) 100vw, 1208px\" \/><\/p>\n<p>Now move to the \u201cNone\u201d option for external devices.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1215\" height=\"772\" class=\"wp-image-15171\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-373.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-373.png 1215w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-373-300x191.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-373-1024x651.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-373-768x488.png 768w\" sizes=\"auto, (max-width: 1215px) 100vw, 1215px\" \/><\/p>\n<p>Now the &#8220;FAT32&#8221; partition is available. Move to the partition and from the bottom move to the &#8220;Undeleted&#8221; option and press Enter to see all deleted and undeleted files and recover the deleted file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1217\" height=\"770\" class=\"wp-image-15172\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-374.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-374.png 1217w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-374-300x190.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-374-1024x648.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-374-768x486.png 768w\" sizes=\"auto, (max-width: 1217px) 100vw, 1217px\" \/><\/p>\n<p>The files in &#8220;red color&#8221; are deleted files that can be recovered. I want to recover &#8220;Linux&#8221; and I will move to that file and then press &#8220;c&#8221; to copy the deleted file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1213\" height=\"771\" class=\"wp-image-15173\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-375.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-375.png 1213w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-375-300x191.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-375-1024x651.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-375-768x488.png 768w\" sizes=\"auto, (max-width: 1213px) 100vw, 1213px\" \/><\/p>\n<p>Now select the destination where you want to copy the file and press \u201cC\u201d after selecting the correct destination. <img loading=\"lazy\" decoding=\"async\" width=\"1212\" height=\"771\" class=\"wp-image-15174\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-376.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-376.png 1212w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-376-300x191.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-376-1024x651.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-376-768x489.png 768w\" sizes=\"auto, (max-width: 1212px) 100vw, 1212px\" \/><\/p>\n<p>Now the file is copied successfully.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1214\" height=\"763\" class=\"wp-image-15175\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-377.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-377.png 1214w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-377-300x189.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-377-1024x644.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-377-768x483.png 768w\" sizes=\"auto, (max-width: 1214px) 100vw, 1214px\" \/><\/p>\n<h2><strong>Conclusion:<\/strong><\/h2>\n<p>Data loss is a major problem that causes a lot of stress but there are many recovery tools that help to recover lost data. In this article, we discussed the recovery methods of deleted data in Ubuntu (Linux OS). There are two ways; one is to recover data from the Trash directory and the other is through Test Disk software, which is open source software and helpful in recovering data from external mediums also. If you lost some valuable data and want to recover the data on Ubuntu then don&#8217;t worry, the solution is provided in this article.<\/p>","protected":false},"excerpt":{"rendered":"<p>Loss of data is one of the most stressful and painful experiences a user can have. The fear of never being able to recover valuable data once it&hellip;<\/p>","protected":false},"author":1,"featured_media":15284,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4,891,5,83,165,2],"tags":[759,35],"class_list":["post-15161","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-debian","category-manjaro","category-mint","category-opensuse","category-red-hat","category-ubuntu","tag-data","tag-linux"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/15161","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=15161"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/15161\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/15284"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=15161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=15161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=15161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}