Log in Go to the main page Page History Go to the file list Go to the site toolbox

Rm command

From NetworkStuff

Utilities-terminal-v2-256.png

Linux-logo-large.png

A CLI command available on most Linux platforms; used to remove (delete) files and directories.

Contents

Preferences-desktop-font-v2-22.png Usage Syntax

rm [options] (file_name | directory_name | reg_exp)

Common options include;

  • -f - force removal, ignore non-existent files, never prompt
  • -i - interactive; prompt before every removal
  • -I - prompt once before removing more than three files or directories, or when removing recursively
  • -r or -R - remove directories and their contents recursively
  • --one-file-system - when removing recursively, skip any directory that is on a file system different from that of the starting point initially specified
  • -v - verbose; display detailed information on what is being done

Vm-power-on-medium.png Usage Examples

rm -rf * - remove all files and directories recursively, without prompting for confirmation, from the present working directory down. Very dangerous!

rm -rI * - remove all files and directories recursively, prompting for confirmation only once, from the present working directory down.

Accessories-text-editor-v2-medium.png Usage Notes

This command supports most Shell Expansion Characters and Regular Expressions

Most Red Hat based Linux distributions (Fedora, Mandriva, CentOS) use an alias of rm of rm -i which results in a prompt for every file or directory removal even if the -f option is used. To prevent this behaviour, remove the alias using this command: unalias rm.

Gnometris-medium.png Command Combinations

See our Remove Files Found By Find article

Accessories-text-editor-v2-medium.png Linux Usage Notes

With most Linux or Unix commands;

  • Non root users may need to prefix commands with the sudo command, for example: sudo chmod 644 *
  • Brief help can be displayed using the -h or --help parameter, for example: chmod --help
  • A full command manual can be displayed using the man command followed by the command name, for example: man chmod
  • Sometimes 'info' pages are used instead of or to provide more information than man pages; for example: info chmod
  • Version information can normally be display using the -v, -V or --version parameter, for example: chmod --version. However, this paramater is also frequently used to display verbose output.

Folder-medium.png Related Files

The rm executable is normally found here: /bin/rm

Icemon-medium.png Related Commands

Use the ls command to list directory contents

Use the cd command to change the current (working) directory

Use the ln command to link files

Use the cp command to copy files and directories

Use the mv command to move files and directories

Use the pwd command to display (or print) the current working directory

Use the mkdir command to create (or make) a new directory

Object-flip-horizontal-medium.png Command Equivalents

The Cisco command equivalents are the delete command (for files) and the rmdir command for directories Cisco-logo-small.png

The Windows Command Prompt equivalents are the delete command (for files) and the rmdir command for directories Preferences-system-windows-small.png

Icemon-medium.png Related Articles

Information on other Linux commands Linux-logo-small.png

Information on F5 BigIP commands F5-logo-small.png

Information on Cisco commands Cisco-logo-small.png

Information on Vyatta commands Vyatta-logo-small.png

Information on Extreme commands Extreme-logo-small.png

Information on Nortel commands Nortel-logo-small.png

Information on Zebra commands

Information on Windows commands Preferences-system-windows-small.png

Information on Secure Platform commands

Information on Blue Coat SGOS commands

Information on Nokia IPSO commands


Internet-group-chat-small.png We really do appreciate all feedback so please do send your comments, suggestions or corrections to steve#networkstuff.eu (replacing the # with an @)


F5 BigIP Commands

Personal tools
This page was last modified on 31 March 2010, at 13:17. - Disclaimers - About Network Stuff
Powered by MediaWiki