1. anon

    1. open up .bashrc
    2. create the alias:
    alias rm=’rm -i’
    alias cp=’cp -i’
    alias mv=’mv -i’
    3. save exit & logout/login

    now everytime you do this, it’ll double-check what files you want to delete. if you’re feeling dangerous some day and don’t feel like pressing ‘y’ a bunch of times, simply run the command as follows to have it delete the files without asking:

    $\rm *
    (ie: add a backslash before rm)

  2. Christian

    I eventually ran in this problem too. now, what I do to avoid this problem is, after peeking into a directory like

    me@localhost:~/important$ ls unimportant

    deleting the directory with

    me@localhost:~/important$ rm -rf !$

    the “!$” is a special variable referencing to the last argument in the previous command. It’s also very useful if you ls-ed for some specific files and want to delete them.

Leave a Reply

Your email address will not be published. Required fields are marked *