I'm using Ubuntu on my personal laptop, and on my system, whenever I use rm on a file, it is gone. for good.
The problem is on my university server.
I am trying to delete a folder: environment/tests from my home directory. To my big surprise, when I use rm environment/tests (for some strange reason, rm does not require the -R option in order to delete a folder on the university server...), this is what I get:

u2 **** 114 : rm environment/tests
/bin/mv: cannot move `environment/tests/' to `/u/stud/****/../TrashCan/****/tests': File exists
u2 **** 115 :

(the **** are replacement for my username)

So I tried to remove it from the Trash can, but realized it's a recursive call... :)

u2 **** 157 : rm ~/../TrashCan/****/tests
/bin/mv: `/u/stud/****/../TrashCan/****/tests' and `/u/stud/****/../TrashCan/****/tests' are the same file
u2 **** 158 :

First of all, what does mv has to do here? (notice it is a /bin/mv error)
Second, how can I delete this folder once and for all?
In fact, while I'm at it, I'd like to completely empty the TrashCan. But again, this:

u2 **** 169 : rm * ~/../TrashCan/

Does not work.
The server runs the following version:

u2 **** 170 : uname -a
Linux u2 2.6.32-504.8.1.el6.x86_64 #1 SMP Wed Jan 28 21:11:36 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
u2 **** 171 :
  • 2
    Can you please check the value of alias rm? – mohit Aug 12 '15 at 10:04
  • How can I do that? – so.very.tired Aug 12 '15 at 10:05
  • Just execute the command alias rm to see if rm has been aliased on your system. – mohit Aug 12 '15 at 10:05
  • 2
    Most likely rm is superseded by mv * /wherever/TrashCan/$USER/ to allow quick data recovery as some students seemingly had accidentally removed essential files. Check alias rm and if nothing strange shows up whereis rm and then read the file to which this points you. – Fiximan Aug 12 '15 at 10:06
  • Aw! Yes it has been aliased! /bin/mv -f !* /u/stud/****/../TrashCan/**** That explains the mv! Now, how can I use the original rm (I want to keep the alias though) – so.very.tired Aug 12 '15 at 10:08

The command rm as been aliased to /bin/mv -f !* /u/stud/****/../TrashCan/****.

Prefix the aliased command with \ to disable the alias:

\rm, will run the original rm command.

| improve this answer | |

It seems that someone has created an alias for rm command (probably replaced it by mv command) on the system.

You can check by executing:

alias rm

You can reset it to default by:

alias rm="rm -v"
| improve this answer | |
  • 1
    You can reset it to the default with a simple unalias rm – roaima Oct 16 '16 at 22:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.