Linux: How to recover files after emptying Trash or using Shift + Del

Read this article to find out how to recover files lost in Linux after emptying the Trash folder on Linux. We will also explore a scenario when data is removed with the shortcut Shift + Del without using the Trash (that is, when it’s deleted irreversibly).

Linux: How to recover files after emptying Trash or using Shift + Del

Just like other operating systems, Linux also has Trash (Bin) folder where files end up when you delete them. Peculiarities of the operating system suggest that deleted files can be restored from Trash if you haven’t emptied it yet. But what shall we do after emptying Trash, or when files and folders are removed with the key shortcut Shift + Del?

Go to view
How to install a data recovery tool on Linux_ with a terminal or a file manager

How to install a data recovery tool on Linux_ with a terminal or a file manager

Method 1. How to recover a file or folder from Linux Trash

If you have just deleted a folder with important data, you can easily restore it by going to the Trash folder. To do it, open Trash and click Restore from Trash. The file or folder will reappear in their original directory.

Ubuntu: Restore from Trash

This way, we can recover accidentally deleted files.

Method 2. How to recover files after emptying Linux Trash or using Shift + Del

When you delete a file or folder, and then empty Trash, or remove something with the key shortcut Shift + Del, it counts as irreversible file deletion.

Shift + Del (in some environments) – can remove a file without placing it into Trash.

In fact, files deleted from Trash can be restored with specialized data recovery software, such as Hetman Partition Recovery.

The tool recovers data from any devices, regardless of the cause of data loss.
  • Suppose we have some data in the Documents folder. Let’s remove the files with the key shortcut Shift + Del;

    Ubuntu: Shift + Del
  • The files are gone, and you can’t see them in the Trash folder;

    Ubuntu: Trash is empty
  • To recover the deleted files, run Hetman Partition Recovery and click on the disk where this data used to be stored;

    Hetman Partition Recovery: open disk
  • Choose the scan type. For starters, a Fast scan will be enough.

    Hetman Partition Recovery: Fast scan
  • When the scan is over, click Finish. The program has found our files. We can also view the files in the Preview window.

    Hetman Partition Recovery: deleted files are found
  • To recover necessary files, drag them to the Recovery List. If you can’t see one, go to ViewToolbarsRecovery List;

    Hetman Partition Recovery: Recovery List
  • Choose the method to save them;

  • Choose a folder and click Recovery.

    Hetman Partition Recovery: the folder to recover files to

I’d like to draw your attention to one peculiarity of recovering data from Linux Fedora. Since this version of Linux uses btrfs, for your recovery operations you’ll need another tool – Hetman RAID Recovery.

Recover data from damaged RAID arrays inaccessible from a computer.
Hetman RAID Recovery

Linux partition system and file systems

Remember that some versions of Linux create separate partitions for the system and for user files. This should not confuse you. However, if you need to restore user data from the Desktop or such folders as Documents, Pictures, Music etc, it means you should scan the partition containing user files.

Sometimes it has a corresponding name or marking. For example,

  • For example, Ubuntu and Mint do not create such separate partitions for user data. These systems only create a common partition with Ext4 file system. You can see it both in the Disks utility and the recovery tool.

    Ubuntu: Ext4
  • In CentOS, the user data partition is named cs.home, and its file system is XFS. Meanwhile, Cs.root is meant for the operating system and software. Cs.swap is used as a swap file when there is not enough random-access memory, or for hibernation.

    CentOS: XFS
  • In Fedora the system of partitions is somewhat similar to the one used in CentOS. Here, the user data partition is named fedora, and its file system is btrfs. Ext4 is the system partition. Zram is used for the swap file.

    Fedora: btrfs
Linux distribution Standard file system
Ubuntu ext4
Debian ext4
Fedora ext4, Btrfs (by default since Fedora 33)
Arch Linux ext4
Manjaro ext4, Btrfs
openSUSE Btrfs, XFS
CentOS ext4, XFS
RHEL (Red Hat Enterprise Linux) XFS, ext4
Kali Linux ext4
Linux Mint ext4
Pop!_OS ext4
Zorin OS ext4
Elementary OS ext4
Slackware ext4
Gentoo ext4, XFS, Btrfs

The default file system can change depending on the distribution version and user settings. Some distributions also support ZFS, ReiserFS and other file systems.

Where Linux keeps Trash files

If the Fast scan in Hetman Partition Recovery failed to find your files in the folder where they used to be stored before (and from where they were sent to Trash), or if you need to restore the files that were lost after emptying Trash, then try to find them in the Trash system folder.

What I mean is that Trash is only a system tool used to manage deleted files. But as a matter of fact, it is the folder where the operating system moves the deleted files.

By default, in all versions of Linux this path can be found here:

home/.local/share/Trash/

Ubuntu Trash:  home/.local/share/Trash/

There are two folders:

~/.local/share/Trash/files – the folder with deleted files, specifically;

~/.local/share/Trash/info — the folder with information about these files.

Also, you should remember that if your computer has several hard disks, the operating system creates a Trash folder on each of them. Files deleted from this particular disk will be sent to such folder.

In the graphical interface of the system, you can’t see it, since the Trash folder displays all files sent to the Trash from any disk.

However, these details become more important when data is recovered: if you are trying to recover data moved to Trash from a non-system disk, go to the Trash folder in the root directory of such disk. You will find them in that particular location.

Mint Trash:  /medial/usr/.Trash-1000

All right, so when you need to recover files lost after emptying the Trash folder:

  • For illustration, let’s go to Trash where there are some files, and empty it.

    Ubuntu: Empty Trash
  • Run the program and click on the disk from where the data was removed.

    Hetman Partition Recovery: open disk
  • Wait for the scan to be over, if you haven’t run the scan yet.

    Hetman Partition Recovery: disk scan
  • Go to the Trash system folder. Check the folders to see if your files are there;

    Hetman Partition Recovery: Trash system folder
  • To recover necessary files, drag them to the Recovery List and click Recovery;

    Hetman Partition Recovery: Recovery List
  • After that, select the saving method and click Recovery again;

  • When the operation is complete, all files will be placed into the folder you have chosen.

    Ubuntu: recovered files

Full analysis

If the files were deleted a long time ago, and it is only now that you realize they are missing... or if the program couldn’t find the necessary data during Fast scan, then scan the disk using Full analysis.

To do it:

  • Go to the recovery tool window and right-click on the required disk. Choose Analyze again;

    Hetman Partition Recovery: Analyze again
  • Now choose Full analysis;

  • Specify the disk file system;

    As a rule, the program identifies the file system of the disk automatically. However, if you need to know the file system used for a specific disk, go to the Disks utility to find this information.

    Hetman Partition Recovery: Full analysis
  • As you specify the disk file system, click Next. This process can take some time.

  • When the scan is over, you can see all deleted files.

Conclusions

Now you know several ways to recover accidentally deleted data in Linux. Regardless of whether you emptied Linux Trash or accidentally deleted files and folders using the key shortcut Shift + Del, the methods described here will help you solve the problem.

The tool recovers data from any devices, regardless of the cause of data loss.
Vladimir Artiukh

Author: , Technical Writer

Vladimir Artiukh is a technical writer for Hetman Software, as well as the voice and face of their English-speaking YouTube channel, Hetman Software: Data Recovery for Windows. He handles tutorials, how-tos, and detailed reviews on how the company’s tools work with all kinds of data storage devices.

Oleg Afonin

Editor: , Technical Writer

Oleg Afonin is an expert in mobile forensics, data recovery and computer systems. He often attends large data security conferences, and writes several blogs for such resources as xaker.ru, Elcomsoft and Habr. In addition to his online activities, Oleg’s articles are also published in professional magazines. Also, Oleg Afonin is the co-author of a well-known book, Mobile Forensics - Advanced Investigative Strategies.

Recommended For You

Hello! This is AI-based Hetman Software virtual assistant, and it will answer any of your questions right away.
Start Chat