Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2003
    Posts
    187

    how to remove a directory in linux that isnt empty?

    I want to remove a directory and all directories and files under it.

    How can i do this in red hat?

  2. #2
    Join Date
    May 2004
    Posts
    394
    rm -rf directory_name

  3. #3
    Originally posted by almahdi
    rm -rf directory_name
    the r is for recussive to go throught directory and the f forces the deletion instead of asking you.

  4. #4
    Join Date
    Apr 2005
    Location
    Under The Floor Tiles
    Posts
    566
    Just be careful when you use rm-rf. What I mean by this is that the average user might type (instinctively):
    rm -rf ./(directory)

    And if anyone suggests rm -rf / to you... just don't. (Forces removal of all directories and files in root, which is... well, every directory and file on the server.)

  5. #5
    Join Date
    Jun 2004
    Location
    California
    Posts
    682
    is Midnight Command installed?

    Try typing mc (it will either load or tell you its an unknown command).

    If it is, browse to the dir yo uwant to delete then click on the delete button in the bottom right.

    Its alot harder to accidentily wipe out extra things using mc...
    Scott Swezey
    TCL Fasteners, Inc.
    Automotive fasteners for collision shops.

  6. #6
    Join Date
    Feb 2004
    Location
    Sofia
    Posts
    1,349
    first cd to the parent dir (of the dir to be removed tmp/) before using the "rem -rf tmp/"
    :: :: :: :: :: ::
    :: VDSP.Net :: Directory of virtual and dedi serv providers by location and price

  7. #7
    Join Date
    Jun 2004
    Location
    California
    Posts
    682
    Originally posted by Imago
    first cd to the parent dir (of the dir to be removed tmp/) before using the "rem -rf tmp/"
    tmp/ being the dir you wanted to delete?

    Also, is rem even a command? I'm still learning *nix, but it doesnt work on my system and I've never seen it mentioned before? Maybe you need to alias it to 'rm' or something...
    Scott Swezey
    TCL Fasteners, Inc.
    Automotive fasteners for collision shops.

Posting Permissions

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