File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Linux / UNIX and the fly likes Recycle bin in linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Recycle bin in linux" Watch "Recycle bin in linux" New topic

Recycle bin in linux

Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242
I am a beginner and have used only Windows. Is there any way to retrive the deleted files in Linux as we have in windows recycle bin? What is the mechanism in linux? Thanks.
Marco Ehrentreich
best scout

Joined: Mar 07, 2007
Posts: 1294

Hi Gopu,

generally this is more difficult and different than under Windows OSes. Linux offers a lot more file systems than Windows does which may be a main reason that there's mostly no unified concept of a "recycle bin" on the file system layer. The only undelete tool I know is for ext2 file systems. I guess there are more tools but probably they are specific to one file system.

The other way is how the Windows recycle bin probably works, too. Graphical desktop environments like Gnome or KDE have a concept of a recycle bin where you can undelete files etc. But for this to work you also have to use the recycle bin to delete files or directories. If you delete them directly without the recycle bin knowing it they are gone forever (without special tools).

I hope this makes it a little clearer

[ May 28, 2008: Message edited by: Marco Ehrentreich ]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

It's actually a lot like Windows. If you delete a file from CMD or COMMAND.EXE or a Windows application, it doesn't go into a recycle bin either. Likewise it probably won't go into a recycle bin if it's on a network drive.

The concept of a recycle bin is something that is generally done at the GUI desktop level, so if you delete a file any other way it normally won't get saved. That's just tradition, however. There's no reason why a Linux filesystem couldn't be made to support a bin at the OS level. In fact, with the Userspace file system, you could probably easily implement a facade for the ext2/3 or other filesystem(s) of your choice that converted deletion operations into "move to recycle bin directory" operations.

The really fun thing about Linux, however, is that unlike Windows, there's more than one Desktop manager to choose from and no real standard on where they should put their recycle bins (if any). It's usually a hidden directory in your desktop or home directory, however .

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Recycle bin in linux
It's not a secret anymore!