rm command - Daily Linux Commands

rm command Introduction

rm command to delete a directory in one or more files or directories can also be a directory and its subdirectories subordinate all files are deleted. For the linked file, just delete the entire link file, and the original file remains unchanged.

Note: Use rm command to be extra careful, especially beginners. Because once a file is deleted, it can not be recovered . (Such as in the implementation of rm * -rf / (root directory), then the whole system will be destroyed in this command.)

grammar

rm (option) (parameters)

Command Function

To delete a directory of one or more files or directories, if no - r option, rm will not remove directories. If you use rm to delete the file, the file can usually still restitution.

Options

-d: hard-wired directly to the deleted directory data to be deleted to 0, delete the directory;
-f: force delete files or directories;
-i: first asking the user before deleting an existing file or directory;
-R & lt or -R: recursive processing, all files in the specified directory and subdirectories processed together;
--preserve the root-: recursion is not the root directory;
-v: show details of the process execution instruction.

parameter

File: Specifies the list of files to be deleted, if the parameter contains a directory, you must add the -r or -R option.

Examples

Interactive delete the current file test and example directory

-i the Test Example RM
the Remove the Test? the n-(do not delete files the Test)
the Remove Example? the y-(deleting files example)

Delete all current files and subdirectories except hidden files in the directory

rm -r *

It should be noted this can be very dangerous!

Related Commands

cp
dirs
cd
install
the popd
mkdir
pushd
LS
rmdir
Tree
mv
pwd
(links relevant orders to be filled in)

Guess you like

Origin www.cnblogs.com/reckful/p/11291673.html
Recommended