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] files...
gomi -l | --list
gomi -r | --restore item_id_or_name
gomi -e | --empty

PARAMETERS

files...
    One or more files or directories to move to the trash directory.

-l, --list
    Lists all items currently in the trash directory, often with their original path and deletion timestamp.

-r, --restore item_id_or_name
    Restores a specified item from the trash back to its original location or a specified path. The item can often be identified by an ID from the list, or part of its original name.

-e, --empty
    Permanently deletes all contents from the trash directory, freeing up disk space. This action is irreversible.

DESCRIPTION

gomi is not a standard command included with most Linux distributions.
Instead, it refers to a class of user-created scripts or utilities designed to provide a "trash" or "recycle bin" functionality, similar to graphical desktop environments.
Unlike the permanent deletion performed by the rm command, gomi scripts move specified files and directories to a designated hidden directory (the "trash can") on the filesystem.
This allows users to recover accidentally deleted files, preventing data loss.
The exact behavior, options, and trash location of a gomi implementation can vary widely, as it is typically a custom script written by individuals or small communities to suit their needs.

CAVEATS

It is important to understand that gomi is not a standard Linux command; its existence and behavior depend entirely on whether a user or system administrator has installed or created such a script.
The functionality can vary significantly between different implementations.
Potential caveats include the trash directory consuming significant disk space over time if not regularly emptied, and the absence of a standardized trash directory location across all systems (though some follow the XDG Base Directory Specification for ~/.local/share/Trash).

TRASH DIRECTORY LOCATION

Custom gomi scripts typically store trashed files in a hidden directory within the user's home directory, such as ~/.trash or ~/.gomi.
More standardized implementations often follow the XDG Base Directory Specification, placing trashed files in ~/.local/share/Trash/. This directory contains subdirectories for files and info (metadata about original paths and deletion dates).

HISTORY

The concept of a 'trash can' or 'recycle bin' originated in graphical user interfaces (GUIs) to prevent accidental data loss. As Linux command-line users increasingly desired similar safety nets, various individuals and developers began creating shell scripts or simple utilities to emulate this behavior.
These scripts, often informally referred to as 'gomi' (Japanese for 'trash' or 'garbage'), typically leverage standard commands like mv to move files to a hidden directory rather than using the destructive rm.
While no single standard 'gomi' command emerged, the need led to more robust solutions like trash-cli, which standardize the trash handling according to XDG specifications, fulfilling the same core user requirement.

SEE ALSO

rm(1), mv(1), find(1), trash-cli(1)

Copied to clipboard