In computing, the trash, also known by other names such as trash bin, dustbin, wastebasket, and similar names, is a graphical user interface desktop metaphor for temporary storage for files set aside by the user for deletion, but which are not yet permanently erased. This lifts the burden from the user of having to be highly careful while selecting files for deletion, since a trash bin provides a grace period to reverse unwanted deletions. The concept and name is part of Mac operating systems; a similar implementation is called the Recycle Bin in Microsoft Windows, and other operating systems use other names, sometimes ending with "-bin".

In the file manager, the trash can be viewed by the user as a special file directory, allowing the user to browse the files and retain those still wanted before deleting the others permanently (either one by one, or via an "empty trash" command). It may still be possible using third party software to undelete those that were deleted by mistake. In Microsoft Windows and macOS, the Trash folder links to hidden folders on each mounted drive where the files are actually stored.

Within a trash folder, a record may be kept of each file and/or directory's original location, depending on the implementation. On certain operating systems, files must be moved out of the trash before they can be accessed again. Some operating systems or file managers retain trashed files indefinitely until manually deleted by the user, while others may delete them automatically based on certain criteria: for example, after a given file has resided in the trash bin for a certain duration of time, as in the case of Android, or once the trash bin grows to a certain size (see § Microsoft Windows). Unlike in conventional folders, a trash bin may be able to contain files with duplicate names, given that a trash bin acts as a layer before permanent deletion from the file system. An implementation may store trashed files using custom names and references back to their original name stored as metadata, and/or inside hidden subfolders with non-duplicate names on the file system, such as the subfolders inside the $RECYCLE.BIN folder on Microsoft Windows. This is because the user needs to be able to trash any file that they would normally be able to permanently delete, including files with identical names stored in different directories.Android 11 has a hidden Recycle Bin for trashed photos and videos - XDA Developers (June 12th, 2020)

Whether or not files deleted by a program go to the recycle bin depends on its level of integration with a particular desktop environment and its function. Low-level utilities usually bypass this layer entirely and delete files immediately. A program that includes file manager functionality may or may not send files to the recycle bin, or it may allow the user to choose between these options.

History Bill Atkinson began developing the Apple Lisa user interface in late 1978. In March 1982 he reached the stage of changing to an icon-based file manager, and produced a mock-up with a trash can icon (including buzzing flies) for deleting files. The release version of Lisa was launched in 1983 with a "Wastebasket", Apple Invents the Personal Computer. Again., 1983 its icon "an alley-style garbage can [with] vertical lines to indicate a ribbed surface .... an open lid and a handle on the front of the can." Apple advertised "If you can find the trash can, you can run a computer."

Following this, the Magic Desk I ROM cartridge for Commodore 64 presented a primitive representation of office furniture, with a wastebasket or trash bin under the desk. This lacked functionality and was not taken further.

In 1983 Susan Kare designed the core visual design language of Classic Mac OS System 1, launched in January 1984. This incorporated some elements of the Lisa interface, including a refined version of the icon, now labelled Trash, with "a closed lid with a handle on top." An ad supplement in Newsweek introduced the Mac interface, with its "pictures of objects you'll have no trouble recognizing ... Even a trash can." A subsequent update to Lisa renamed its Wastebasket icon "Trash". In "International English" localizations of Classic Mac OS, Trash was named "Wastebasket".

In 1985, Amiga Workbench 1.0 was released. This took much inspiration from Mac OS, including trash bins. When formatting a floppy disk/hard drive partition, the user could select to add a bin to it. This would then appear as an icon titled "Trashcan" along with the other files. Users could drag unwanted files onto it and empty the bin later.1.1.5 Info, 1.2.1 Empty Trash Photographic Evidence

In early versions of the Macintosh Finder, Trash contents were in volatile memory, and were lost when the computer restarted. From 1987, if anything was in Trash its icon bulged as a reminder to check the contents before shutting down. Following the 1991 introduction of System 7, the Trash folder retains its contents until the user chooses to empty the trash.

The outcome of the lawsuit Apple Computer, Inc. v. Microsoft Corp. (filed in 1988, decision affirmed on appeal in 1994) was that graphical user interfaces similar to Apple's did not infringe rights, but some features including Apple's Trash icon were original and protected by copyright. Non-Apple software could use other metaphors for file deletion, such as Recycle Bin, Smart Eraser, or Shredder.

In 1993 or 1994, Microsoft implemented its first temporary deletion system in MS-DOS 6, under the name Delete Sentry: When a file was deleted, it was moved to a hidden SENTRY folder at the root of the drive.

Microsoft introduced its current trash system in 1995, the Recycle Bin, with Windows 95, as an area to store and review files and folders prior to deletion. At default settings, the Recycle Bin auto-deletion permanently deletes files to free up disk space when it gets low, or deletes files in the Bin over 30 days. In this version, the original location record of the file is stored, but the folder itself did not allow subdirectories. When a folder is deleted, its containing files are moved into the bin and mixed with other deleted files. The directory structure can only be restored if the batch of files is "undeleted". The current (revised) Recycle Bin allows for subdirectory trees to exist within folders that have been moved there. The icon shows a bin with a recycling symbol on its front.

With the new interface of Mac OS X introduced in 2001, the Trash icon moved from the desktop to a permanent place at the end of the Dock. The International English "Wastebasket" had been dropped at the end of 2009, making the name "Trash" standard. In keeping with the system appearance, the Trash was a shiny wire basket, until with OS X Yosemite in 2014 it became a translucent white container. With macOS Mojave, the Trash was renamed "Bin" in the Australian English localisation, and with macOS Catalina, "Bin" also appeared in the UK localisation.

Implementations Trash functionality is usually integrated into a desktop environment and its file manager. Examples include:

Classic Mac OS and macOS, with Finder, as "Trash" (localised as "Wastebasket", later "Bin") MS-DOS 6.x, with Microsoft Undelete, as "Delete Sentry" Microsoft Windows, with Windows Explorer (later called File Explorer starting with Windows 8), as "Recycle Bin" GNOME and MATE (Linux), with Nautilus and Caja, respectively KDE (Linux), with Konqueror and Dolphin Xfce (Linux), with Thunar Amiga, with Workbench. The Professional File System added trashcan-esque behavior at the filesystem level. Linux Mint with its default file manager, Nemo. Android OS since version 11, with a 30-day "grace period" until trashed files are removed from the file system.

Some implementations may contain "shredding" functionality to counter data remanence.

Linux desktop environments The KDE, GNOME and Xfce implementations comply with the freedesktop.org Trash specification, ensuring that any applications written with this specification in mind will be interoperable with any trash can implementation.

Although the various Linux desktop environments such as GNOME, KDE, and Xfce provide a trash mechanism, there is traditionally no simple way to trash something from the command line interface. Some third-party applications, such as trash-cli, provide commands on the command-line to use the trash, compatible with the FreeDesktop.org Trash Specification.

macOS Using macOS, a file or folder is deleted in Finder by dragging its icon onto the Trash icon at the right hand end of the Dock, moving the item into the Trash folder, where it can be viewed but not used until it is moved out again. To restore highlighted items from the Trash to their original position, a contextual menu brings up a Put Back option. The keyboard shortcut to move highlighted items to Trash, or Put Back items, is . To finally delete files, clicking on "Empty" brings up a warning that this cannot be undone, and an option to delete.

Putting items in the Trash folder moves them to a hidden temporary folder: for the boot disk, a user account has this at ; each mounted volume such as an external drive has a hidden folder in the root folder named . When viewing the device's available space the space occupied by the deleted files is shown as occupied. The Trash folder shows deleted files from external drives, including removable media. This does not apply to networked drives, where trying to move an item to Trash brings up a warning that it will be deleted immediately and this cannot be undone.

Since OS X El Capitan, the Trash can be bypassed by pressing when a file is selected. Since macOS Sierra, the user can enable an option to have the Trash automatically empty after 30 days.

In UK and Australian English localisations, the Trash is known as "Bin".

Apps and iOS In several macOS apps and in the iOS mobile operating system, the Trash is within apps rather than in the system as a central feature. The standard icon for the Trash is a small version of the original Classic Mac OS trash can. Files are moved to a "Recently Deleted" folder within the app where they remain available for recovery for a stated number of days, then are automatically permanently deleted. Apps where this applies include Photos and Mail. Files may still be recoverable if a computer backup was run before they were moved to "Recently Deleted".

Microsoft Windows

Microsoft's Recycle Bin is implemented as a special folder with columns like Date deleted and Original location. Typically only files deleted via File Explorer (but not necessarily other Windows graphical interfaces such as file selection dialogs) will be put into the Recycle Bin; files deleted via the Command Prompt are permanently deleted, as (by default) are files deleted via operating system APIs and applications other than Windows Explorer. Some operating system APIs do, however, allow applications to recycle files rather than delete them. In previous Windows operating systems and in MS-DOS, undeletion was the only way to recover accidentally or intentionally deleted files.

As standard, the Recycle Bin only stores files deleted from hard drives, not from removable media, such as memory cards, thumb drives, or floppy disks, nor does it store files deleted from network drives. There are methods to make it work on network paths, however.