Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

rm -R <directoryname> not working as expected

Discussion in 'General Discussion' started by cookiesunshinex, Aug 31, 2006.

  1. cookiesunshinex

    cookiesunshinex Well-Known Member

    Joined:
    Jun 10, 2005
    Messages:
    77
    Likes Received:
    0
    Trophy Points:
    156
    When I issue the command:

    root@host [/home/user1/public_html]# rm -R directory1

    instead of the directory and all subdirectories and all files in those directories being deleted, I get:

    rm: descend into directory `directory1'?

    This did not happen in the past.

    Any ideas why?

    Thanks..
     
  2. NightStorm

    NightStorm Well-Known Member

    Joined:
    Jul 28, 2003
    Messages:
    286
    Likes Received:
    4
    Trophy Points:
    168
    cPanel Access Level:
    Root Administrator
    Twitter:
    It's asking for confirmation. Try adding the -f flag.
    rm -Rf directory1

    NOTE: This is final. Make absolutely certain you got the right directory typed in before you hit that enter key. I am constantly seeing cases of people wiping out important things (like /) by not properly formatting the command.
     
  3. websupport

    websupport Well-Known Member

    Joined:
    Jun 24, 2006
    Messages:
    92
    Likes Received:
    0
    Trophy Points:
    156
  4. Shinichi Kato

    Shinichi Kato Well-Known Member

    Joined:
    Mar 7, 2005
    Messages:
    73
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Saitama-ken,japan
    root@host [/home/user1/public_html]# ls | xargs rm -R directory1
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. mctDarren

    mctDarren Well-Known Member

    Joined:
    Jan 6, 2004
    Messages:
    664
    Likes Received:
    3
    Trophy Points:
    168
    Location:
    New Jersey
    cPanel Access Level:
    Root Administrator
    Your rm binary may have been recently updated?
     
  6. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,470
    Likes Received:
    21
    Trophy Points:
    463
    Location:
    Go on, have a guess
    It's most likely you've (had) created an alias in .bash_profile or /bashrc that changes rm to rf -i to get the true behaviour either remove the alias and logout and back in again, or run the binary directly from /bin/rm
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. cookiesunshinex

    cookiesunshinex Well-Known Member

    Joined:
    Jun 10, 2005
    Messages:
    77
    Likes Received:
    0
    Trophy Points:
    156
    Thanks Chirpy that certainly explains what might be happening (or has happened).

    I found the following files:
    /root/.bashrc

    which contains:
    ==================
    # .bashrc

    # User specific aliases and functions

    alias rm='rm -i'
    alias cp='cp -i'
    alias mv='mv -i'

    # Source global definitions
    if [ -f /etc/bashrc ]; then
    . /etc/bashrc
    fi
    ======EOF============

    I also found
    /etc/bashrc

    which does NOT contain the line:
    alias rm='rm -i'


    The .bashrc that is contained in the user's home directories does not contain the Alias either.

    So this makes sense that the root account uses the alias rm='rm -i' and thus I'm getting prompted to descend into the directories and to delete the files.

    Whereas, the user's accounts do not have the alias set either in the /home/user1/.bashrc file or in the /etc/bashrc file.

    Thanks for this help.
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice