Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Jun 2005
    Posts
    77

    Default rm -R <directoryname> not working as expected

    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. #2
    Member
    Join Date
    Jul 2003
    Posts
    275

    Default

    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. #3
    Member
    Join Date
    Jun 2006
    Posts
    92

    Post Check links for more info on rm -R command


  4. #4
    Member Shinichi Kato's Avatar
    Join Date
    Mar 2005
    Location
    Saitama-ken,japan
    Posts
    73

    Wink

    root@host [/home/user1/public_html]# ls | xargs rm -R directory1
    Service of my company is "free web server" "shared web server" "dedicated web server" in Japan.
    [ADSV.JP]FREE WEB SERVER
    Total Media Studio Help Forum
    TMS at GoogleMap

  5. #5
    Member serversphere's Avatar
    Join Date
    Jan 2004
    Posts
    658

    Default

    Your rm binary may have been recently updated?

  6. #6
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    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
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  7. #7
    Member
    Join Date
    Jun 2005
    Posts
    77

    Default

    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.

Similar Threads & Tags
Similar threads

  1. regex filtering not behaving as expected
    By JTO in forum E-mail Discussions
    Replies: 0
    Last Post: 09-30-2009, 10:10 AM
  2. DNS Clustering not working as expected?
    By Xavior82 in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 08-28-2009, 08:58 AM
  3. Cron jobs do not start as expected...
    By exdiogene in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 07-01-2008, 10:30 AM
  4. Auto-resonder not working as expected
    By hockeythug in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 02-09-2004, 11:35 AM
  5. ModernBill Has Went Further Than Expected
    By jackal in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 12-13-2003, 03:09 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube