{"id":16649261,"url":"https://github.com/rcmdnk/trash","last_synced_at":"2025-04-09T16:52:45.611Z","repository":{"id":11580913,"uuid":"14070446","full_name":"rcmdnk/trash","owner":"rcmdnk","description":"Remove Command using a trash box.","archived":false,"fork":false,"pushed_at":"2023-12-01T08:28:38.000Z","size":64,"stargazers_count":20,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T19:02:00.034Z","etag":null,"topics":["bash","linux","macos","sentaku","shellscript","trash","trash-box","windows","zsh"],"latest_commit_sha":null,"homepage":"http://rcmdnk.github.io/blog/2013/04/23/computer-bash-linux-mac/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rcmdnk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"rcmdnk","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2013-11-02T17:23:57.000Z","updated_at":"2024-07-03T06:25:50.000Z","dependencies_parsed_at":"2022-09-02T03:23:00.628Z","dependency_job_id":null,"html_url":"https://github.com/rcmdnk/trash","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcmdnk%2Ftrash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcmdnk%2Ftrash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcmdnk%2Ftrash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcmdnk%2Ftrash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rcmdnk","download_url":"https://codeload.github.com/rcmdnk/trash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248073558,"owners_count":21043465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","linux","macos","sentaku","shellscript","trash","trash-box","windows","zsh"],"created_at":"2024-10-12T09:08:18.708Z","updated_at":"2025-04-09T16:52:45.590Z","avatar_url":"https://github.com/rcmdnk.png","language":"Shell","funding_links":["https://github.com/sponsors/rcmdnk"],"categories":[],"sub_categories":[],"readme":"trash\n=====\n\nRemove Command using a trash box.\n\n`rm` command removes files/directories from the disk and they are not recoverable.\nIt is stressful because we are used to benefit from the trash box on a GUI system, Windows, Mac, Linux, etc..\n\n`trash` command brings you the removal command with recoverable files/directories.\n\n:white_check_mark: current version requires [sentaku](https://github.com/rcmdnk/sentaku).\n\nIf you use Homebrew or cURL to insatll, sentaku will be installed automatically, too.\n\nIf you install the script directly, please install sentaku or use\n[standalone version](https://github.com/rcmdnk/trash/tree/standalone)\n(standalone version could be obsolete).\n\n## Installation\n\nOn Mac, you can install scripts by [Homebrew](https://github.com/mxcl/homebrew):\n\n    $ brew tap rcmdnk/rcmdnkpac\n    $ brew install rcmdnk-trash\n\nIf you have [brew-file](https://github.com/rcmdnk/homebrew-file), add following lines to Brewfile:\n\n    tap 'rcmdnk/rcmdnkpac'\n    brew 'rcmdnk-trash'\n\nthen, do:\n\n    $ brew file install\n\nOr if you write like:\n\n    tapall 'rcmdnk/rcmdnkpac'\n\nand do `brew file install`, you will have all useful scripts in\n[rcmdnkpac](https://github.com/rcmdnk/homebrew-rcmdnkpac).\n\nYou can also use an install script on the web like:\n\n    $ curl -fsSL https://raw.github.com/rcmdnk/trash/install/install.sh| sh\n\nThis will install scripts to `/usr/bin`\nand you may be asked root password.\n\nIf you want to install other directory, do like:\n\n    $ curl -fsSL https://raw.github.com/rcmdnk/trash/install/install.sh|  prefix=~/usr/local/ sh\n\nOr, simply download the script and set where you like.\n\n:warning: Install [sentaku](https://github.com/rcmdnk/sentaku), too\nif you download directly.\n\n## Usage\n\n    # Help\n    Usage: trash [-rficClbV] [-v \u003cverbose level\u003e] [-t \u003ctrash_box\u003e] \u003cfile/directory\u003e\n    \n    Arguments:\n       -r              Remove directory (default: 0)\n       -f              Do not ask when file/directory is removed directly\n                       Do not return error even if file/directory does not exist\n                       -f ignores previous -i option\n       -i              Remove w/ confirmation\n                       -i ignores previous -f option\n       -t \u003ctrash_box\u003e  Use given trash box instead of $tbox\n       -c              Clean up trash box (make it less than MAXTRASHBOXSIZE)\n       -C              Clean up trash box (make it empty)\n       -l              List up deleted files/directories in the trash box\n       -b              Restore (turn Back) the file from the trash box\n       -v \u003clevel\u003e      Verbose level for list view\n                       0 : Only original location (default).\n                       1 : With Delete date-time (yyyymdd-hh:mm).\n                       2 : With Current location (in the trash box).\n       -V              Show version\n       -h              Show help\n    \n    To use trash, please specify following variables\n    in .bashrc or your setting file like (these rh values are default):\n    \n    At restore mode, you can use following keys (based on vim move):\n     \u003cn\u003e   : (any numb), set n for move\n     j     : n-down (if n is not defined, 1 down)\n     ^D    : Half page down\n     ^F    : Page down\n     k     : n-up   (if n is not defined, 1 up)\n     ^U    : Half page up\n     ^B    : Page up\n     gg    : Go to top    (if n is defined, go to n)\n     G     : Go to bottom (if n is defined, go to n)\n     d     : Delete\n     s     : Show details\n     /     : Search mode\n     Enter : Select to bring back to the original place, and quit\n     h     : Select to copy it to current directory, and quit\n     q     : Quit\n    \n    export TRASHLIST=~/.trashlist # Where trash list is written\n    export TRASHBOX=~/.Trash # Where trash will be moved in\n                             # (.Trash is Mac's trash box)\n    export MAXTRASHBOXSIZE=1024 # Max trash box size in MB\n                                # Used for clean up\n    export MAXTRASHSIZE=\\`echo \\$MAXTRASHBOXSIZE \\\"*\\\" 0.1|bc -l|cut -d. -f1\\`\n        # Trashes larger than MAXTRASHBOXSIZE will be removed by 'rm' directly\n    \"\n\n## Tips\n\n### Alias\n\nFollowing alias is useful to use trash:\n\n    alias del=\"trash -i -r\" # Do not confirm, remove directory, too\n\n### Clean up\n\nYou may be want to clean up trash box regularly to keep the box not too much.\n\nTo clean up regularly, first please set `MAXTRASHBOXSIZE` as described\nin above help.\n\nThen, `trash -c` will clean up the trash box until it becomes less than `MAXTRASHSIZE`.\n\nYou can set it as a cron job like:\n\n    0 1 * * * /path/to/trash -c\n\nto execute every night (1am, 00min).\n    \n\nIn addition, you can empty your trash box for trash by\n\n    $ trash -C\n\n## References\n\n* [rm -rfのプロテクト、コマンドラインでのゴミ箱](http://rcmdnk.github.io/blog/2013/04/23/computer-bash-linux-mac/)\n\n* [コマンドラインで使うゴミ箱コマンド](http://rcmdnk.github.io/blog/2014/01/12/computer-bash/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frcmdnk%2Ftrash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frcmdnk%2Ftrash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frcmdnk%2Ftrash/lists"}