How to Send Files to the Trash Can in Linux with Gio Trash Updated on January 14, 2025 by InMotion Hosting Contributor 2 Minutes, 25 Seconds to Read When you run out of disk space or want to remove unnecessary files to increase server security, you may end up deleting a lot of files in a short period of time. If you’re in the Linux terminal / SSH, you’ll likely use the rm command. But this permanently deletes files (excluding data recovery methods) and can result in you having to restore from backup files if you delete the wrong file(s). The solution may already be on your machine. The gio trash command will send files to your trash can for later review. It’s pre-installed on many Linux operating systems (OSs) and the successor to gvfsd-trash. It’s important to remember that gio trash sends files to ~/.local/share/Trash/files instead of ~/.trash, used on cPanel managed servers. The .local/share/Trash directory includes three directories: info stores deleted files’ original location and deletion time files stores deleted files until it’s emptied expunged may temporarily hold recently emptied trash Below we cover how to send files to the trash can and permanently delete files with gio. Try our Cloud Server Hosting today and upgrade your disk space anytime without downtime. Send Files to Trash with gio trash Open your terminal. Move files to .trash: gio trash [FILE1] [FILE2] View the trash in .local/share/Trash/files: gio list trash:// Or ls ~/.local/share/Trash/files Empty the trash can: gio trash --empty man gio | grep trash Below is the man gio trash information: man gio | grep trash trash [OPTION...] [LOCATION...] Sends files or directories to the "Trashcan". This can be a different folder depending on where the file is located, and not all file systems support this concept. In the common case that the file lives inside a users home directory, the trash folder is $XDG_DATA_HOME/Trash. Note that moving files to the trash does not free up space on the file system until the "Trashcan" is emptied. If you are interested in deleting a file irreversibly, see the remove command. Inspecting and emptying the "Trashcan" is normally supported by graphical file managers such as nautilus, but you can also see the trash with the command: gio list trash://. Options -f, --force Ignore non-existent and non-deletable files. --empty Empty the trash. Use gio help trash for short a short summary. Delete Files Permanently with gio remove You can also permanently remove files with the gio remove command: gio remove [FILE1] [FILE2] Use the -f option to ignore non-existent and non-deletable files: gio remove -f [FILE1] [FILE2] [FILE3] The trash and delete options are also available in popular GUI applications. cPanel users have the File Manager to move files to ~/.trash or delete files.Linux desktop file managers (e.g. Thunar and Nemo) have options if you right-click files or select Edit from the top menu. What lesser known Linux commands do you know? Let us know in our Community Support Center. Share this Article InMotion Hosting Contributor Content Writer InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals! More Articles by InMotion Hosting Related Articles Understanding Linux Operating Systems How to Install Python 3.9 on CentOS 7 Speed Up grep Searches with LC_ALL=C How To Install RubyGems On Linux unrar and rar Commands 5 Ways to Find a File in Linux Setting Your PHP Settings in Command Line How to Check the Memory Usage on Linux How to Send Files to the Trash Can in Linux with Gio Trash How to Merge PDF Files in the Linux Terminal