Install package GIO (Gnome Input Output)

sudo apt install libgio-2.0 try this in debian based distro - sudo apt install libglib2.0-dev`

After installling check your file manager gui app through nautilus or nemo or anything working

You can try deleting files manually through gui way from those file manager apps or for CLI usecase this way:

gio trash nameofyourfile.txt

its gone into your recycle bin.

This is just one of the use of GIO. It actually bundle humongus amount of functions.

Gio comes with lots of options

~ ᓚᘏᗢ >_  gio
Usage:
  gio COMMAND [ARGS…]

Commands:
  help     Print help
  version  Print version
  cat      Concatenate files to standard output
  copy     Copy one or more files
  info     Show information about locations
  launch   Launch an application from a desktop file
  list     List the contents of locations
  mime     Get or set the handler for a mimetype
  mkdir    Create directories
  monitor  Monitor files and directories for changes
  mount    Mount or unmount the locations
  move     Move one or more files
  open     Open files with the default application
  rename   Rename a file
  remove   Delete one or more files
  save     Read from standard input and save
  set      Set a file attribute
  trash    Move files or directories to the trash
  tree     Lists the contents of locations in a tree

Use “gio help COMMAND” to get detailed help.

Turns out it not only move files back and forth to trash but can also perform none trashy actions:

There are lots of stuff can be done with this.

Reference: https://docs.gtk.org/gio/