|
| 1 | +TRASH(1) |
| 2 | + |
| 3 | +# NAME |
| 4 | + |
| 5 | +trash(1) - A near drop-in replacement for `rm` that uses the trash bin |
| 6 | + |
| 7 | +The name of this software is "trash-d" however its executable |
| 8 | +is simply called *trash*. This manual favors the latter, but the two |
| 9 | +should be considered interchangeable. |
| 10 | + |
| 11 | +# SYNOPSIS |
| 12 | + |
| 13 | +trash [_option_]... _file_... |
| 14 | + |
| 15 | +# DESCRIPTION |
| 16 | + |
| 17 | +A near drop-in replacement for *rm*(1) that uses the FreeDesktop trash bin. |
| 18 | +Written in the D programming language using only D's Phobos standard library. |
| 19 | + |
| 20 | +The options and flags are intended to mirror *rm*'s closely, with some |
| 21 | +additional long options for the *trash* specific features. |
| 22 | + |
| 23 | +## Options |
| 24 | + |
| 25 | +*-d*, *--dir* |
| 26 | +: Remove empty directories. |
| 27 | + |
| 28 | +*-r*, *-R*, *--recursive* |
| 29 | +: Delete directories and their contents. |
| 30 | + |
| 31 | +*-v*, *--verbose* |
| 32 | +: Print more information. |
| 33 | + |
| 34 | +*-i*, *--interactive* |
| 35 | +: Ask before each deletion. |
| 36 | + |
| 37 | +*-I*, *--interact-once* |
| 38 | +: Ask before deleting 3 or more files, or deleting recursively |
| 39 | + |
| 40 | +*-f*, *--force* |
| 41 | +: Don't prompt and ignore errors. |
| 42 | + |
| 43 | +*--version* |
| 44 | +: Output the version and exit. |
| 45 | + |
| 46 | +*--list* |
| 47 | +: List out the files in the trash. |
| 48 | + |
| 49 | +*--orphans* |
| 50 | +: List orphaned files in the trash. |
| 51 | + |
| 52 | +*--delete* _file_ |
| 53 | +: Delete a file from the trash. |
| 54 | + |
| 55 | +*--restore* _file_ |
| 56 | +: Restore a file from the trash. |
| 57 | + |
| 58 | +*--empty* |
| 59 | +: Empty the trash bin. |
| 60 | + |
| 61 | +*--rm* _files_... |
| 62 | +: Escape hatch to permanently delete a file. |
| 63 | + |
| 64 | +*-h*, *--help* |
| 65 | +: This help information. |
| 66 | + |
| 67 | +## Precedence |
| 68 | + |
| 69 | +The *--help*, *--version*, *--list*, *--orphans*, |
| 70 | +*--restore*, *--delete*, and *--empty* flags all cause the program |
| 71 | +to short-circuit and perform only that operation and no others. Their |
| 72 | +precedence is in that order exactly, and is intended to cause the least |
| 73 | +destruction. |
| 74 | + |
| 75 | +Therefore the command '`trash --empty --list`' will list the trash bin and NOT |
| 76 | +empty it. |
| 77 | + |
| 78 | +*Note:* Before version 11 trash-d followed a slightly incorrect precedence |
| 79 | +order. |
| 80 | + |
| 81 | +## Compatibility with *rm*(1) |
| 82 | + |
| 83 | +One of trash-d's primary goals is near compatibility with the GNU *rm(1)* |
| 84 | +tool. The keyword here is "near". The goal is not exact flag-for-flag |
| 85 | +compatibility with *rm*, but you should be able to '`alias rm=trash`' and |
| 86 | +not notice the difference. But since *rm* has different failure states and |
| 87 | +error messages it can never be 100% compatible. |
| 88 | + |
| 89 | +Additionally since there are a few different implementations of *rm(1)* |
| 90 | +(BSDs and so on) that are all subtly incompatible with each other I can't |
| 91 | +guarantee compatibility with all versions. |
| 92 | + |
| 93 | +As of version 16 unknown options will throw an error. Prior to |
| 94 | +version 16 unknown options were silently ignored. |
| 95 | + |
| 96 | +As of version 17 trash-d will not follow symlinks recursively through |
| 97 | +directories. This may in some cases be inconsistent with *rm* but errs on |
| 98 | +the side of not deleting your files. |
| 99 | + |
| 100 | +# ENVIRONMENT |
| 101 | + |
| 102 | +*XDG_DATA_HOME* |
| 103 | +This variable is used to determine where the default trash directory is for |
| 104 | +this user as per the FreeDesktop specification. |
| 105 | + |
| 106 | +*TRASH_D_DIR* |
| 107 | +Override the trash directory to the specified path, useful for trashing on |
| 108 | +removable devices. |
| 109 | + |
| 110 | +# FILES |
| 111 | + |
| 112 | +*$XDG_DATA_HOME/Trash* |
| 113 | +Standard location of trash files and metadata as per the FreeDesktop |
| 114 | +specification. Used in the absence of *$TRASH_D_DIR*. |
| 115 | + |
| 116 | +*~/.local/share/Trash* |
| 117 | +The fallback path used in the absence of both *$XDG_DATA_HOME* and |
| 118 | +*$TRASH_D_DIR*. |
| 119 | + |
| 120 | +# EXIT STATUS |
| 121 | + |
| 122 | +*trash* exits with the status code 0 on success, and >0 if an error occurs. |
| 123 | + |
| 124 | +# SEE ALSO |
| 125 | + |
| 126 | +*rm*(1), *user-dirs.conf*(5) |
| 127 | + |
| 128 | +# STANDARDS |
| 129 | + |
| 130 | +By mimicking *rm* this utility is partially POSIX compliant however this is |
| 131 | +*NOT* to be relied upon for any purpose. |
| 132 | + |
| 133 | +trash-d is compliant with the FreeDesktop trash specification: |
| 134 | +https://specifications.freedesktop.org/trash-spec/trashspec-latest.html |
| 135 | + |
| 136 | +# AUTHOR |
| 137 | + |
| 138 | +Steven vanZyl <rushsteve1@rushsteve1.us> |
| 139 | + |
| 140 | +The up-to-date sources can be found at: https://github.com/rushsteve1/trash-d |
| 141 | + |
| 142 | +# BUGS |
| 143 | + |
| 144 | +https://github.com/rushsteve1/trash-d/issues |
0 commit comments