{"id":19715527,"url":"https://github.com/hudson-newey/2rm","last_synced_at":"2026-04-11T03:16:15.484Z","repository":{"id":254122847,"uuid":"845526775","full_name":"hudson-newey/2rm","owner":"hudson-newey","description":"A \"rm\" replacement with soft-deletes, config-based deletion, debug information, and saner defaults","archived":false,"fork":false,"pushed_at":"2026-04-11T00:44:33.000Z","size":100,"stargazers_count":3,"open_issues_count":17,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-11T02:23:45.202Z","etag":null,"topics":["cli","golang","rm","trash","trash-cli","trashcan"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hudson-newey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-08-21T12:24:56.000Z","updated_at":"2026-04-11T00:44:07.000Z","dependencies_parsed_at":"2024-12-27T04:21:05.081Z","dependency_job_id":"d8bad210-ef04-40fc-bcd6-ef0899f44d8c","html_url":"https://github.com/hudson-newey/2rm","commit_stats":null,"previous_names":["hudson-newey/2rm"],"tags_count":49,"template":false,"template_full_name":null,"purl":"pkg:github/hudson-newey/2rm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hudson-newey%2F2rm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hudson-newey%2F2rm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hudson-newey%2F2rm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hudson-newey%2F2rm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hudson-newey","download_url":"https://codeload.github.com/hudson-newey/2rm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hudson-newey%2F2rm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31667268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"online","status_checked_at":"2026-04-11T02:00:05.776Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cli","golang","rm","trash","trash-cli","trashcan"],"created_at":"2024-11-11T22:38:38.090Z","updated_at":"2026-04-11T03:16:15.478Z","avatar_url":"https://github.com/hudson-newey.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 2RM\n\nA \"rm\" replacement with soft-deletes, config-based deletion, debug information, and saner defaults.\n\n## Comparison\n\n### Feature comparison\n\n| Feature                | [2rm](https://github.com/hudson-newey/2rm) | [trash-cli](https://github.com/andreafrancia/trash-cli) | [shell-safe-rm](https://github.com/kaelzhang/shell-safe-rm) | [trashy](https://github.com/oberblastmeister/trashy) | [gomi](https://github.com/babarot/gomi) | [trash](https://github.com/sindresorhus/trash) |\n| ---------------------- | ------------------------------------------ | ------------------------------------------------------- | ----------------------------------------------------------- | ---------------------------------------------------- | --------------------------------------- | ---------------------------------------------- |\n| Config-based deletion  | ✅                                         | ❌                                                      | ✅ ^1                                                       | ❌                                                   | ❌                                      | ❌                                             |\n| Supports dry runs      | ✅                                         | ❌                                                      | ❌                                                          | ❌                                                   | ❌                                      | ❌                                             |\n| GNU \"rm\" compatibility | ✅                                         | ❌                                                      | ❌                                                          | ❌                                                   | ❌                                      | ❌                                             |\n| Comes with \"man\" pages | ✅                                         | ✅                                                      | ❌                                                          | ✅                                                   | ❌                                      | ❌                                             |\n\n#### Notes\n\n- ^1 - Shell safe rm supports configuring the soft delete backup location and protected files, but does not support any of the other config options provided by 2rm\n\n## \"GNU Like\" command line arguments\n\n- `-i` Interactively prompt before each deletion request\n- `-I` Prompt if deleting more than the interactive threshold of files (default 3)\n- `-r`, `-R`, `--recursive` Recursively delete a directory of files\n- `-v`, `--verbose` Emit additional verbose information\n- `-d`, `--dir` Only delete empty directories\n- `--help` Display help information (without deletion)\n- `--version` Display version information (without deletion)\n- `--interactive[=WHEN]` Interactive with a custom threshold\n  - Never Prompt: `never`, `no`, `none`\n  - Prompt Once: `once`\n  - Always Prompt: `always`, `yes`\n\n## Additional command line arguments\n\n- `--overwrite` Overwrite the disk location location with zeros\n- `-H`, `--hard` Do not soft-delete file\n- `-S`, `--soft` Soft delete a file and store a backup (default `/tmp/2rm`)\n- `--silent` Do not print out additional information priduced by 2rm. This is useful for scripting situations\n- `--dry-run` Perform a dry run and show all the files that would be deleted\n- `--bypass-protected` Using this flag will allow you to delete a file protected by the 2rm config\n- `--notify` Send a system notification once deletion is complete\n- `--force` Bypass 2rm protections\n\n## Unsupported command line arguments\n\n- `--one-file-system` Do not allow cross-file-system deletes\n- `-f`, `--force` Bypass protections (full GNU \"rm\" compatibility)\n\n## Features\n\n### Removes the ability to remove your root directory\n\nI have done this so that you can't accidentally add a space and remove your root directory with a typo such as\n\n```sh\n$ rm -rf ./directory /\n\u003e\n```\n\n(yes I know that you have to use `--no-preserve-root` and I have removed that too)\n\n### Delete directories without the `-r` flag\n\nYou no longer have to add the `-r` flag when deleting a directory\n\n(although you still can if you want to)\n\n### Soft-deletes by default\n\nBy default, the program will soft delete your files by adding a hard link to the file in the `/tmp/2rm` directory.\n\nThis means that the files underlying INode is not freed, and can be recovered from the `/tmp/2rm` directory if you deleted the wrong file by mistake.\n\nBy using the `/tmp` directory, the operating system will **automatically hard delete files upon restart**.\n\nSometimes you want to hard delete a file/directory every time that you run the `rm` command e.g. you probably want your `node_modules` hard deleted every time and never want to soft delete them.\nIn this case, you can modify your `~/.local/share/2rm/config.yml` file to always hard delete `node_modules`.\n\n### Overwriting disk location with zeros\n\nWhen deleting a file with the linux inbuilt `rm` command, the file is still available on disk.\n\nMeaning that the file can still be recovered by any sufficiently technical user.\n\nThis can be problematic when dealing with sensitive files such as private keys that if leaked could lead to catastrophic consequences.\n\nYou can overwrite a files disk location (rendering it unrecoverable) by using the `--overwrite` flag.\n\n2rm will still soft-delete the file by default, but the soft-deleted file will be completely filled with zeros.\n\nI made the decision that overwritten files will still be soft deleted because it might be useful for timestamp logging/auditing purposes.\nE.g. \"when did I overwrite xyz\"\n\nIf you want to fully delete a file from disk and the file system use both the `--overwrite` and `--hard` flags.\n\n### Config-based deletion\n\nYou can specify what directories are soft-deleted anb hard-deleted by using the `~/.local/share/2rm/config.yml` file.\n\nThis is useful because you usually don't want to soft-delete directories such as `node_modules`, and cache files.\nTherefore, instead of constantly calling the GNU \"rm\" command or constantly passing in the `--hard` flag, you can\nset up a 2rm config file to automatically hard delete certain paths.\n\n```yml\n# user specific: ~/.local/share/2rm/config.yml\n# system wide: /etc/2rm/config.yml\n\n# defaults to /tmp/2rm/ if not specified\n# in the config file\n# any files that are soft deleted will be\n# backed up in the `backups` directory\nbackups: /tmp/2rm/\n# whenever files matching these paths are deleted\n# the disk location will be overwritten with zeros\noverwrite:\n  # when deleting ssh keys, we always want to\n  # overwrite them with zeros to protect\n  # against attackers recovering the production\n  # ssh keys\n  - \".ssh/*\"\nhard:\n  - \"node_modules/\"\n  - \"target/\"\n  - \".angular/\"\n  - \".next/\"\n  - \".cache/\"\n  - \".nx/\"\n# always soft delete backup files,\n# regardless of it they are configured\n# for a hard delete\nsoft:\n  - \"*.bak\"\n# do not allow deleting these files/directories\n# without using the `--bypass-protected` flag this\n# does not make the file protected at the system level\n# through other tools, but it does protect against\n# accidental deletion through 2rm\nprotected:\n  - \".ssh/\"\n# when using the -I flag without any arguments, the user will be prompted\n# for confirmation before deleting each file if the number of files is\n# greater or equal to this threshold\n# default is 3 files/directories\ninteractive: 10\n```\n\n### Error codes\n\n#### Error code _1_\n\nAn error that would have been thrown by a traditional \"rm\" command such as\nthe GNU \"rm\" implementation.\n\n#### Error code _2_\n\nAn error was thrown during 2rm functionality (e.g. deleting a protected file)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhudson-newey%2F2rm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhudson-newey%2F2rm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhudson-newey%2F2rm/lists"}