Giter Club home page Giter Club logo

shell-safe-rm's Introduction

 _______  _______  _______  _______         ______    __   __
|       ||   _   ||       ||       |       |    _ |  |  |_|  |
|  _____||  |_|  ||    ___||    ___| ____  |   | ||  |       |
| |_____ |       ||   |___ |   |___ |____| |   |_||_ |       |
|_____  ||       ||    ___||    ___|       |    __  ||       |
 _____| ||   _   ||   |    |   |___        |   |  | || ||_|| |
|_______||__| |__||___|    |_______|       |___|  |_||_|   |_|

A much safer replacement of bash rm with ALMOST FULL features of the origin rm command.

Initially developed on Mac OS X, then tested on Linux.

Using safe-rm, the files or directories you choose to remove will move to $HOME/.Trash instead of simply deleting them. You could put them back whenever you want manually.

If a file or directory with the same name already exists in the Trash, the name of newly-deleted items will be ended with the current date and time.

Supported options

For those implemented options, safe-rm will act exactly the same as the original rm command

-i, --interactive

-f, --force

-r, -R, --recursive, --Recursive

-v, --verbose

--

Combined short options are also supported, such as

-rf, -riv, etc

Usual Installation

Add an alias to your ~/.bashrc script,

alias rm='/path/to/bin/rm.sh'

and /path/to is where you git clone shell-safe-rm in your local machine.

Permanent Installation

If you have NPM (node) installed (RECOMMENDED):

npm i -g safe-rm

Or normally with make:

make && sudo make install
# and enjoy

For those who have no make command:

sudo sh install.sh

Installing safe-rm will put safe-rm in your /bin directory. In order to use safe-rm, you need to add an alias to your ~/.bashrc script and in all yours currently open terminals, like this:

alias rm='safe-rm'

After installation and alias definition, when you execute rm command in the Terminal, lines of below will be printed:

> rm
safe-rm
usage: rm [-f | -i] [-dPRrvW] file ...
     unlink file

which helps to tell safe-rm from the original rm.

Uninstall

First remove the alias line from your ~/.bashrc file, then

npm uninstall -g safe-rm

Or

make && sudo make uninstall

Or

sudo sh uninstall.sh

shell-safe-rm's People

Contributors

kaelzhang avatar bunop avatar zacanger avatar

Watchers

Viren avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.