Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    remove recursively

    the rm command man pages discusses removing files or directories recursively.

    So what is meant by deleting a file or directory recursively? and what are some reasons for doing so?

  2. #2
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    the hills
    It means removing a directory, and everything in it.

  3. #3
    If you want to delete a directory/folder, you have to use -r. If the directory is empty, you can also use rmdir

  4. $spacer_open
  5. #4
    Just Joined!
    Join Date
    Nov 2007
    Salt Lake City, UT, USA
    As a general rule, anytime I am using rm -r, I will specify the entire path of the folder I wanted deleted recursively.

    For instance, if I want to delete the contents of directory lame-program from /opt/software/lame-program, I'll do
    /opt/software/lame-program# rm -r /opt/software/lame-program/*
    instead of
    /opt/software/lame-program# rm -r ./*
    Once, during a down-time window at work in the middle of the night, I meant to run the command as shown in the 2nd example, but forgot a pretty important part:
    /opt/software/lame-program# rm -r /*
    . The missing dot means your root partition is going to get deleted recursively. It isn't a fun place to be in. After that experience, I always go non-lazy when rm -r is involved.

Posting Permissions

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