Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-11-23
8
Medium Priority
?
461 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 252 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 252 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
How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

 
LVL 5

Assisted Solution

by:John Pope
John Pope earned 249 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 249 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 498 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 498 total points
ID: 40469533
You cannot intercept system calls, but you can replace rm command with mv -d ~/Recycle
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

715 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