Linux RM CP MV Command Instance

Source: Internet
Author: User


Delete Copy move File command

Linux Code

Rm-rf/file

-r: Recursive processing parameters
-F: Force removal of all files

Linux Code

Cp/test1/file1/test3/file2

Copy the file1 to test3 and rename it to File2

Linux Code

CP-A Test Test1

Copy all subdirectories under the test directory to Test1

Linux Code

Mv/test1/file1/test2/test2

Move File1 to Test2 and rename to Test2

CP command

The command D function key will give the D file or directory copy to another file or directory, the same as msdos under the dcopy command, the function is very powerful.

Syntax: CP [option] source file or directory destination file or directory

Note: This command copies the specified d source file to the destination file or copies multiple source files to the destination directory.

The command d options have the following meanings:

-A This option is typically used when copying a directory. It retains links, file attributes, and recursively copies the directory, which is equal to the DPR option D combination.

-Keep links when copying D.

-F Delete already exists D target file without prompting.

-I and F options, in contrast, will prompt the user for confirmation before overwriting the target file. Answer y when the target file will be overwritten with the key interactive copy.

-P At this point, the CP will also copy its modification time and access rights to the new file in addition to the source file D content.

-R If the D source file is given a directory file, the CP will recursively replicate all D subdirectories and files in that directory. The destination file must be a directory name at this time.

-L do not make a copy, only the key link file.

Cp-r/home/usera/* /mnt/temp

/home/usera are not copied, hidden files under subdirectories will be Copy, the target directory must be an existing  

cp-r/home/usera/ .    /mnt/temp  

hidden files and all files under the/home/usera directory and subdirectories are copy, the target directory can not exist

MV Command

Feature Description: Move or rename an existing file or directory.

Syntax: MV [-bfiuv][--help][--version][-s < Append tail >][-v < method >][source file or directory] [destination file or directory]

Note: MV can move a file or directory, or change the name of a file or directory.

Parameters
-B or--backup overwrite the file, overwriting the previous backup.
-F or--force if the destination file or directory is duplicated with an existing file or directory, overwrite the existing file or directory directly.
-I or--interactive to ask the user before overwriting.
-s< additional word > or
--suffix=< additional tail > with the-b parameter, you can specify the end of the backup file that you want to append.
-U or--update does not overwrite the destination file when it moves or changes the file name, if the destination file already exists and its file date is newer than the source file.
-V or--verbose displays detailed information when executed.
-v=< method > or
The--version-control=< method > is used in conjunction with the-b parameter to specify the method of backup.
--help display Help.
--version Displays version information.

Name: RM

Usage rights: All users
How to use: RM [options] name ...
Description: Delete files and directories.
Parameters:?
-I ask for confirmation before deleting.
-F Even if the original file attribute is set to read-only, it is deleted directly without confirmation.
-R the directory and the following files are also deleted.
Example:
Delete all C-language files; Ask for confirmation before deleting:
Rm-i *.c
Delete all the files in the finished subdirectory and subdirectories:
Rm-r finished
Feature Description: Delete files or directories.
Syntax: RM [-dfirv][--help][--version][file or directory ...]
Additional Note: The Execute RM instruction can delete the file or directory, if you want to delete the directory must add the parameter "-r", otherwise the default will only delete the file.
Parameters
-D or--directory delete the hard connection data for the directory that you want to delete directly by deleting the directory by 0.
-F or--force forces the deletion of files or directories.
-I or--interactive to ask the user before deleting both files or directories.
-R or-R or--recursive recursively handles all files and subdirectories under the specified directory.
-V or--verbose shows the instruction execution process.
--help online Help.
--version Displays version information.


This article is from the "@ Fast unblocked @" blog, make sure to keep this source http://speediness.blog.51cto.com/760841/1783312

Linux RM CP MV Command Instance

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.