I have a folder called - bin , then I remove it by rm bin , re-create it and when I want to remove it again by rm bin the shell promts -

/bin/mv: cannot move `bin/' to `/u/y2010/zarnihu/../TrashCan/zarnihu/bin': File exists

seems it not let remove it cause it exist at TrashCan already ...

I work with version - 2.6.18-92.1.18.el5xen

edit - alias :

>> alias
-       ls
=       (ls -a)
cp      (cp -i)
l.      ls -d .* --color=tty
ll      ls -l --color=tty
ls      ls --color=tty
mc      source /usr/share/mc/bin/mc-wrapper.csh
moonshine       rdesktop -g 1024x768 moonshine &
mv      (mv -i)
passwd  (links https://netsrv.cs.biu.ac.il/cgi-bin/change-pass-en.cgi)
pine    (pine -i)
pwd     echo $cwd
rm      (/bin/mv -f !* /u/y2010/zarnihu/../TrashCan/zarnihu)
unrm    cd $TRASH_CAN && /bin/mv -f !* $owd; cd -
unsetdisplay    echo remove $DISPLAY | xauth
vi      vim
  • Can you past the output of alias ?
    – prateek61
    Apr 7 '13 at 12:49
  • @prateek61 added
    – URL87
    Apr 7 '13 at 12:53
  • @prateek61 How could I check that ?
    – URL87
    Apr 7 '13 at 13:16
  • You could fix that particular error message by adding --backup to the mv options, however that won't make unrm work twice in reverse. Apr 7 '13 at 13:25
  • The rm alias has a very strange path in it: ../TrashCan/zarnihu. That's going into a TrashCan directory that is a sibling to your home directory. Additionally, the unrm alias right below uses the environment variable $TRASH_CAN. Can you tell us the result of echo $TRASH_CAN and also cd ~; pwd; cd /u/y2010/zarnihu/../TrashCan/zarnihu; ls -al. I suspect that either your TrashCan directory is supposed to be under your home dir, or that the permissions are not set correctly in the TrashCan directory. Apr 7 '13 at 18:46

You have a broken setup that stashes deleted files into some kind of thrash directory, and doesn't know what to do when you delete the same twice. Workaround is to locate said thrash and clean it out (or really get rid of the stored bin). Perhaps running the real /bin/rm directly helps.

Folks, Unix is unforgiving, you are in charge, you are supposed to know what you are doing, there is no "the benevolent developer saves us from our mistakes by not allowing us to do anything remotely dangerous" here. That is where its power lies. Training wheels, worst of all invisible ones, just get in the way (and hinder learning). Tomorrow the training-wheel-used will stumble upon a system without them. It won't be pretty...


I'm guessing you are logged into a remote system where someone has done some custom configuration for users and screwed up a little bit.


rm      (/bin/mv -f !* /u/y2010/zarnihu/../TrashCan/zarnihu)

Should work, but evidently there's some issue (perhaps /bin/mv has been linked to something that includes -i?).

You should report this to a sys admin. In the meantime, if you want to delete something, you can bypass the whole trash can setup by invoking the rm binary directly:

> whereis rm
/bin/rm /usr/bin/rm

Use the first one, whatever it is, so eg:

> /bin/rm whatever

Should remove "whatever" -- but beware it will not be copied to your trash can, so you will not be able to get it back again.

You could also use /bin/rm that way to clear out the TrashCan/zarnihu directory ;).

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.