Solved

linux : how to configure recycle bin feature when I run shell command - $ rm -rf

Posted on 2014-11-23
8
410 Views
Last Modified: 2015-02-21
we would like to configure our Linux servers in such that, if we accidentally  delete any files, those files  automatically move to some preconfigured directory.

example :  $ rm -rf file.txt

$ls -ltr   /recyclebin
output : file.txt

--
please advice the steps to customize the rm -rf command
0
Comment
Question by:mac_g
8 Comments
 
LVL 11

Assisted Solution

by:andreas
andreas earned 84 total points
ID: 40461515
There is no "built in" way of rm to achive this. you might use some shell scripts or software that does this.

You might look into this.

http://www.webupd8.org/2010/02/make-rm-move-files-to-trash-instead-of.html
0
 

Author Comment

by:mac_g
ID: 40461545
any more inputs ?
please
0
 
LVL 19

Accepted Solution

by:
jools earned 84 total points
ID: 40461795
I wouldnt modify the rm command or create an alias for it at all, it will lead to bad habits, if you rely on a recyclebin for the rm command and you go to a different server with it not set up you might have problems.

I was going to suggest creating a recycle command but andreas found a link to something suitable in his post above.
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 4

Assisted Solution

by:popesy
popesy earned 83 total points
ID: 40461802
Hi

Yes, for me too I have not seen a recycle bin implemented in a Unix system, rather a daily backup solution could possibly be an easier option...it works for us; but of course you may have a slightly different need.

The 'rm' command could be aliased to move ('mv/mvdir') files to the /recyclebin file system and (as andreas alludes to) one could use a shell script to achieve this.

Cheers, JP.
0
 
LVL 25

Assisted Solution

by:madunix
madunix earned 83 total points
ID: 40462939
Unfortunately,It is not possible to configure recycle bin in Linux/Unix. As said above there is no reliable way to recover a deleted files in Linux/Unix . All the methods are just best effort. The best suggestion is to do regular BACKUP on the important files before it is deleted.
http://www.experts-exchange.com/OS/Unix/Q_27314229.html
0
 
LVL 62

Assisted Solution

by:gheist
gheist earned 166 total points
ID: 40468832
alias rm="echo"
0
 

Author Comment

by:mac_g
ID: 40469045
i did not get u
0
 
LVL 62

Assisted Solution

by:gheist
gheist earned 166 total points
ID: 40469533
You cannot intercept system calls, but you can replace rm command with mv -d ~/Recycle
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question