How to Send Files to Trash from the Linux Command Line

3

Using trash-cli to put files into the trash bin from the Linux command line.  (Image credit: Tom's Hardware)
Latest Videos FromTom's Hardware
Shashank Sharma
Freelance Writer

Shashank Sharma is a freelance writer for Tom’s Hardware US, where he writes about his triumphs and joys of working with the Linux CLI.

  • unis_torvalds
    Thank you Toms for this practical article!

    However is important to mention that the commands shown are specific to Debian (and derivatives like Ubuntu).

    Otherwise you risk confusing beginners who have a different package manager with their distro.
    Reply
  • juliancardich
    The recommended way to send files to the trash from the shell is
    gio trash myfileThere is nothing to install.
    Reply
  • bit_user
    It's also worth mentioning that people can enable periodic or manual snapshots on filesystems like BTRFS and ZFS that support them. If you use snapshots, then it protects you not only from unintended deletion but also accidental modification and corruption.

    As for specific instruction or guidance on snapshot usage, that's worth an article all by itself. I'm sure anyone interested can already find a couple, out there.
    Reply