Solved

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

Posted on 2014-11-23
8
421 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 12

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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

730 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