LinuxCommandLibrary

gomi

Move files to the trash/recycle bin

TLDR

Safely delete specific files or folders

$ gomi [path/to/file1 path/to/file2 path/to/folder1 path/to/folder2 ...]
copy

Open an interactive menu to restore one or more files
$ gomi [[-b|--restore]]
copy

Remove files that have been in the trashcan longer than the specified time ([d]ay, [w]eek, [m]onth, [y]ear)
$ gomi --prune [1d|1w|1m|1y|...]
copy

Remove orphaned .trashinfo files
$ gomi --prune [orphans]
copy

SYNOPSIS

gomi [options] file1 file2 ...

PARAMETERS

-v, --verbose
    Enable verbose output, showing each file as it is moved to the trash.

-r, --recursive
    Recursively move directories and their contents to the trash. This is necessary when deleting directories.

-f, --force
    Force deletion, bypassing any prompts or errors. Use with caution!

--version
    Display version information and exit.

-h, --help
    Display a help message and exit.

DESCRIPTION

The gomi command provides a safer alternative to the rm command by moving files and directories to the user's trash or recycle bin, instead of permanently deleting them. This allows for easy recovery of accidentally deleted files.

It adheres to the FreeDesktop.org Trash specification, ensuring compatibility with various desktop environments and file managers. The exact location of the trash directory depends on the system's configuration, but it is commonly located within the user's home directory, under ~/.local/share/Trash.

Gomi improves the user experience by presenting the trash operations in a user-friendly way, preventing unintentional data loss and providing a convenient way to manage deleted files.

CAVEATS

The gomi command relies on the FreeDesktop.org Trash specification. If the specification is not fully implemented or adhered to by your desktop environment or system, the behavior might be unpredictable.

When deleting files from a mounted volume or external drive, the files are moved to a trash directory created on that volume. If that volume is unmounted, the files in the trash directory will be unavailable until the volume is re-mounted.

INSTALLATION

The gomi command is usually distributed through package managers. You can install it using:
Debian/Ubuntu: sudo apt install gomi
Fedora/CentOS/RHEL: sudo dnf install gomi
Arch Linux: sudo pacman -S gomi
Consult your distribution's documentation for details.

FREEDESKTOP.ORG TRASH SPECIFICATION

The gomi command adheres to the FreeDesktop.org Trash specification, ensuring that deleted files are moved to a standardized trash location. This allows different applications and desktop environments to interoperate seamlessly when dealing with trashed files.

SEE ALSO

rm(1), trash-cli(1), gio(1)

Copied to clipboard