Find the answer to your Linux question:
Results 1 to 8 of 8
Hi all, I am not exactly a newbie, but I face what may be a simple problem. Though, I really do not understand what's going on. I cannot use the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2012
    Posts
    5

    Unhappy command 'rm' doesn't work anymore


    Hi all,

    I am not exactly a newbie, but I face what may be a simple problem. Though, I really do not understand what's going on.

    I cannot use the 'rm' command to delete files anymore. When I try, I get the following message:
    mv: missing destination file operand after `/home/name/trash/.'

    It looks like an alias was set somewhere. However, I do not remember setting any such thing and the problem appeared all of suden. I tried to check what was called with:

    $> which rm
    it gives:
    alias rm='rm -i'
    /bin/rm

    I checked and /bin/rm looks like the original one, not a user-defined script.

    Full example:
    $> touch foo
    $> ls -l foo
    -rw-rw-r-- 1 name name 0 Jul 15 15:01 foo
    $> rm foo
    mv: missing destination file operand after `/home/name/trash/.'
    Try `mv --help' for more information.

    Same happends with rm -f, I really have no way to delete files. I can cp, mv without problems. rm works normally as root. The (not) funny thing is that it happens on my account on a computing grid of which I'm the administrator, so I feel a bit stupid... Any suggestions welcome!

  2. #2
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,637
    You are not passing file name in your alias.

    Check the file .bashrc in your home directory and if the alias is there, change it to
    Code:
    alias rm='rm -i $1'
    "I used to be with it, then they changed what it was.
    Now what was it isn't it, and what is it is weird and scary to me.
    It'll happen to you too."

    Grandpa Simpson



    The Fifth Continent

  3. #3
    Just Joined!
    Join Date
    Jul 2012
    Posts
    5
    Does not work. I am pretty sure the alias is correct as it is (it has been like this since a long time working well), but anyway I tried what you suggested.
    After modification and log out/log in, I checked the alias was updated with:
    $> alias
    which gives among other lines: "alias rm='rm -i $1' "

    However, the output when I try to use 'rm' is still the exact same as before...

  4. $spacer_open
    $spacer_close
  5. #4
    Administrator MikeTbob's Avatar
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    7,864
    Code:
    mv: missing destination file operand after `/home/name/trash/.
    Does /home/name/trash exist?
    I do not respond to private messages asking for Linux help, Please keep it on the forums only.
    All new users please read this.** Forum FAQS. ** Adopt an unanswered post.

    I'd rather be lost at the lake than found at home.

  6. #5
    Just Joined!
    Join Date
    Jul 2012
    Posts
    5
    It did exist (which really make me think rm is having this behavior "on purpose"), I deleted it (as root), still the same.

  7. #6
    Just Joined!
    Join Date
    Jul 2012
    Posts
    5
    I got it!

    I had the following in my .bashrc:
    function rm()
    {
    mv $1 ~/trash/.
    }

    Probably I wrote this years ago and uncommented it by mistakes few days ago.

    Well, I guess it's a good point in favour of alias instead of functions: it seems that you can overwrite some commands with a function and there is no way to find it later appart than finding it yourself in .bash* files.

    Anyway, thank you!

  8. #7
    Administrator MikeTbob's Avatar
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    7,864
    Glad you got it sorted and thanks for posting your solution. Feel free to mark this thread as solved, from the top of this thread under "Thread tools".
    I do not respond to private messages asking for Linux help, Please keep it on the forums only.
    All new users please read this.** Forum FAQS. ** Adopt an unanswered post.

    I'd rather be lost at the lake than found at home.

  9. #8
    Just Joined!
    Join Date
    Jul 2012
    Posts
    5
    I found a way to get some information on commands, if I knew it before I could have avoid searching for hours:
    $> type -a <command>
    gives many info, both for alias and functions. Good to know.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •