Play Video
1
Touch Rm - How To Create/Remove a File in Unix/Linux/Aix Terminal Tutorial
Touch Rm - How To Create/Remove a File in Unix/Linux/Aix Terminal Tutorial
::2014/04/20::
Play Video
2
Unix Commands - 04 - Working with CAT and RM Command
Unix Commands - 04 - Working with CAT and RM Command
::2013/05/03::
Play Video
3
Running rm -rf / on Linux
Running rm -rf / on Linux
::2007/11/01::
Play Video
4
rm Command In UNIX
rm Command In UNIX
::2013/11/25::
Play Video
5
UNIX Copy command (cp) ,Remove command (rm)
UNIX Copy command (cp) ,Remove command (rm)
::2013/06/06::
Play Video
6
How to Use RM Command in Unix
How to Use RM Command in Unix
::2013/06/18::
Play Video
7
rm -Rf * Mac
rm -Rf * Mac
::2010/05/02::
Play Video
8
Basic Command MKDIR & RM UNIX Hakiki Edublogs
Basic Command MKDIR & RM UNIX Hakiki Edublogs
::2012/10/04::
Play Video
9
Unix for Neuroimagers 4: mkdir, rmdir, and rm
Unix for Neuroimagers 4: mkdir, rmdir, and rm
::2012/08/18::
Play Video
10
rm files & direcectories Linux UNIX command Easy Man Manual pages by UNIX Academy unixacademy.com
rm files & direcectories Linux UNIX command Easy Man Manual pages by UNIX Academy unixacademy.com
::2010/03/10::
Play Video
11
Running "sudo rm -rf /"
Running "sudo rm -rf /"
::2007/12/25::
Play Video
12
UNIX Lesson - mkdir rmdir touch rmdir rm.wmv
UNIX Lesson - mkdir rmdir touch rmdir rm.wmv
::2010/01/21::
Play Video
13
Comandos UNIX-Date-RM-Finger.wmv
Comandos UNIX-Date-RM-Finger.wmv
::2012/06/07::
Play Video
14
Basic Unix - Parte 1
Basic Unix - Parte 1
::2013/11/28::
Play Video
15
Remove Files From AnArchive using rm -R (Remove Recursively)
Remove Files From AnArchive using rm -R (Remove Recursively)
::2012/01/18::
Play Video
16
Linux is Eating Itself (sudo rm -rf /*)
Linux is Eating Itself (sudo rm -rf /*)
::2012/04/09::
Play Video
17
Typing rm -rf /* In Ubuntu
Typing rm -rf /* In Ubuntu
::2009/05/09::
Play Video
18
unix-rm
unix-rm
::2011/12/03::
Play Video
19
Impove .RM Video Brightness, How to Impove Brightness in .RM Movie file Windows 8
Impove .RM Video Brightness, How to Impove Brightness in .RM Movie file Windows 8
::2014/03/05::
Play Video
20
Linux commands tutorials - What is "rm" command in linux ? How to use "rm" command ?
Linux commands tutorials - What is "rm" command in linux ? How to use "rm" command ?
::2013/11/29::
Play Video
21
sudo rm -rf / in OS X
sudo rm -rf / in OS X
::2007/09/20::
Play Video
22
RM 16
RM 16
::2013/04/22::
Play Video
23
Pixar studio stories - The movie vanishes (full)
Pixar studio stories - The movie vanishes (full)
::2011/06/30::
Play Video
24
Ubuntu Linux: rm -rf /*
Ubuntu Linux: rm -rf /*
::2009/10/12::
Play Video
25
UNIX-1.3 UNIX Commands and Options
UNIX-1.3 UNIX Commands and Options
::2012/05/24::
Play Video
26
RM AM 0 1
RM AM 0 1
::2013/09/29::
Play Video
27
rm -r /
rm -r /
::2012/03/09::
Play Video
28
Mac OS X - sudo rm -rf /
Mac OS X - sudo rm -rf /
::2007/09/18::
Play Video
29
Basic Unix Commands
Basic Unix Commands
::2010/07/14::
Play Video
30
Running the RM command on FreeBSD
Running the RM command on FreeBSD
::2010/08/10::
Play Video
31
UNIX Date command (date)
UNIX Date command (date)
::2013/06/06::
Play Video
32
rm -rf * so you don
rm -rf * so you don't have to
::2011/10/20::
Play Video
33
mv move, rename Linux UNIX command Easy Man Manual pages by UNIX Academy unixacademy.com
mv move, rename Linux UNIX command Easy Man Manual pages by UNIX Academy unixacademy.com
::2010/03/10::
Play Video
34
rm -rf /*
rm -rf /*
::2010/08/11::
Play Video
35
Unix Hindi Tutorial Series Video 8 : Directory Related Commands mkdir & rmdir
Unix Hindi Tutorial Series Video 8 : Directory Related Commands mkdir & rmdir
::2014/02/27::
Play Video
36
Cp and RM in Fm
Cp and RM in Fm
::2013/08/16::
Play Video
37
Terminal Tip 7 rm
Terminal Tip 7 rm
::2009/07/12::
Play Video
38
Creating, Deleting, and Managing Directories in UNIX
Creating, Deleting, and Managing Directories in UNIX
::2013/03/21::
Play Video
39
rm -r / Remove Folder w/ Contents
rm -r / Remove Folder w/ Contents
::2013/08/05::
Play Video
40
UNIX Basic Navigation
UNIX Basic Navigation
::2013/04/17::
Play Video
41
Basic Unix Commands Part 1
Basic Unix Commands Part 1
::2011/08/23::
Play Video
42
LS Perintah Dasar UNIX Hakiki Edublogs
LS Perintah Dasar UNIX Hakiki Edublogs
::2012/10/04::
Play Video
43
1. Basic Commands | Free Unix Commands Tutorial Series | Learn With Pranshu
1. Basic Commands | Free Unix Commands Tutorial Series | Learn With Pranshu
::2013/01/06::
Play Video
44
rm -rf /*
rm -rf /*
::2011/01/04::
Play Video
45
Unix commands - 05 - Working with Head and Tail command
Unix commands - 05 - Working with Head and Tail command
::2013/06/27::
Play Video
46
UNIX Change directory cd)
UNIX Change directory cd)
::2013/06/06::
Play Video
47
Practical Unix: Intro Command Line Part 2
Practical Unix: Intro Command Line Part 2
::2013/12/09::
Play Video
48
rm -rf /
rm -rf /
::2007/10/11::
Play Video
49
touch Command In UNIX
touch Command In UNIX
::2013/11/25::
Play Video
50
 Comandi base - Terminale MAC (bash UNIX) 
 Comandi base - Terminale MAC (bash UNIX) 
::2013/03/15::
NEXT >>
RESULTS [51 .. 101]
From Wikipedia, the free encyclopedia
Jump to: navigation, search

rm (short for remove) is a basic UNIX command used to remove objects such as files, directories, device nodes, symbolic links, and so on from the filesystem. To be more precise, rm removes references to objects from the filesystem, where those objects might have had multiple references (for example, a file with two different names), and the objects themselves are discarded only when all references have been removed and no programs still have open handles to the objects.

This allows for scenarios where a program can open a file, immediately remove it from the filesystem, and then use it for temporary space, knowing that the file's space will be reclaimed after the program exits, even if it exits by crashing.

rm generally does not destroy file data, since its purpose is really merely to unlink references, and the filesystem space freed may still contain leftover data from the removed file. This can be a security concern in some cases, and hardened versions sometimes provide for wiping out the data as the last link is being cut, and programs such as shred are available which specifically provide data wiping capability.

Example[edit]

To remove a file named "foo" from a directory one could type:

   % rm foo

Normally, no output is produced by rm, since it typically only generates messages in the event of an error. The -v option can be used to get rm to detail successful removal actions.

Users concerned about removing files unexpectedly - particularly when using wildcards - sometimes use the -i option to cause rm to verify each removal in advance, although this method has its own problems.[clarification needed]

   % rm -i foo
     remove foo? y

Context[edit]

rm is generally only seen on UNIX-derived operating systems, which typically do not provide for recovery of deleted files through a mechanism like the recycle bin,[1] hence the tendency for users to enclose rm in some kind of wrapper to limit accidental file deletion.

There are undelete utilities that will attempt to reconstruct the index and can bring the file back if the parts were not reused.

Options[edit]

Common options that rm accepts include:

  • -r, which removes directories, removing the contents recursively beforehand (so as not to leave files without a directory to reside in) ("recursive")
  • -i, which asks for every deletion to be confirmed ("interactive")
  • -f, which ignores non-existent files and overrides any confirmation prompts ("force"), although it will not remove files from a directory if the directory is write protected.

rm can be overlain by a C shell alias or Bourne shell function of "rm -i" so as to avoid accidental deletion of files. If a user still wishes to delete a large number of files without confirmation, they can manually cancel out the -i argument by adding the -f option (as the option specified later on the expanded command line "rm -i -f" takes precedence). Unfortunately this approach generates dangerous habits towards the use of wildcarding, leading to its own version of accidental removals.

rm -rf (variously, rm -rf /, rm -rf *, and others) is frequently used in jokes and anecdotes about Unix disasters.[2] The rm -rf variant of the command, if run by a superuser on the root directory, would cause the contents of nearly every writable mounted filesystem on the computer to be deleted, up to the point the system itself crashes from missing some crucial file, directory, or the like.

rm is often used in conjunction with xargs to supply a list of files to delete:

 xargs rm < filelist

Or, to remove all PNG images in all directories below the current one:

 find . -name '*.png' -print0 | xargs -0 rm

Permissions[edit]

Usually, on most filesystems, deleting a file requires write permission on the parent directory (and execute permission, in order to enter the directory in the first place). (Note that, confusingly for beginners, permissions on the file itself are irrelevant. However, GNU rm asks for confirmation if a write-protected file is to be deleted, unless the -f option is used.)

To delete a directory (with rm -r), one must delete all of its contents recursively. This requires that one must have read and write and execute permission to that directory (if it's not empty) and all non-empty subdirectories recursively (if there are any). The read permissions are needed to list the contents of the directory in order to delete them. This sometimes leads to an odd situation where a non-empty directory cannot be deleted because one doesn't have write permission to it and so cannot delete its contents; but if the same directory were empty, one would be able to delete it.

If a file resides in a directory with the sticky bit set, then deleting the file requires one to be the owner of the file.

Protection of the filesystem root[edit]

Sun Microsystems introduced "rm -rf /" protection in Solaris 10, first released in 2005. Upon executing the command, the system now reports that the removal of / is not allowed.[3] Shortly after, the same functionality was introduced into FreeBSD version of rm utility. GNU rm refuses to execute rm -rf / if the --preserve-root option is given, which has been the default since version 6.4 of GNU Core Utilities was released in 2006.

User-proofing[edit]

Systems administrators, designers, and even users often attempt to defend themselves against accidentally deleting files by creating an alias or function along the lines of:

alias rm="rm -i"
rm () { /bin/rm -i "$@" ; }

This results in rm asking the user to confirm on a file-by-file basis whether it should be deleted, by pressing the Y or N key. Unfortunately, this tends to train users to be careless about the wildcards they hand into their rm commands, as well as encouraging a tendency to alternately pound y and the return key to affirm removes - until just past the one file they needed to keep[citation needed]. Users have even been seen going as far as "yes | rm files", which automatically inserts "yes" for each file.[citation needed].

A compromise that allows users to confirm just once, encourages proper wildcarding, and makes verification of the list easier can be achieved with something like:

if [ -n "$PS1" ] ; then
  rm () 
  { 
      ls -FCsd "$@"
      echo 'remove[ny]? ' | tr -d '\012' ; read
      if [ "_$REPLY" = "_y" ]; then
          /bin/rm -rf "$@"
      else
          echo '(cancelled)'
      fi
  }
fi

It's important to note that this function should not be made into a shell script, which would run a risk of it being found ahead of the system rm in the search path, nor should it be allowed in non-interactive shells where it could break batch jobs. Enclosing the definition in the if [ -n "$PS1" ] ; then ....  ; fi construct protects against the latter.

There exist third-party wrappers that prevent accidental deletion of important files, like "safe-rm".[4]

History[edit]

On some old versions of Unix, the rm command would delete directories if they were empty.[5] This behaviour can still be obtained in modern versions of rm, such as the GNU coreutils version, with the -d flag. On modern UNIX and Linux platforms, this functionality has been replaced by the rmdir command.

See also[edit]

References[edit]

External links[edit]

Wikipedia content is licensed under the GFDL License

Mashpedia enables any individual or company to promote their own Youtube-hosted videos or Youtube Channels, offering a simple and effective plan to get them in front of our engaged audience.

Want to learn more? Please contact us at: hello@mashpedia.com

Powered by YouTube
LEGAL
  • Mashpedia © 2014