Linux CP commands

Source: Internet
Author: User

CP command is short for copy, meaning copy

First, man CP

Name
CP-copy files and directories

Synopsis
CP [Option]... [-T] source dest
CP [Option]... source... directory
CP [Option]...-T directory source...

Description
Copy source to DEST, or multiple source (s) to directory.

Mandatory arguments to long options are mandatory for short options too.

-A, -- Archive
Same as-dr -- preserve = all

-- Backup [= control]
Make a backup of each existing destination file

-B like -- backup but does not accept an argument

-- Copy-Contents
Copy contents of special files when recursive

-D same as -- no-dereference -- preserve = Link

-F, -- force
If an existing destination file cannot be opened, remove it and try again

-I, -- interactive
Prompt before Overwrite

-H follow command-line Symbolic Links

-L, -- Link
Link files instead of copying

-L, -- Dereference
Always follow symbolic links

-P, -- no-Dereference
Never follow symbolic links

-P same as -- preserve = mode, ownership, timestamps

-- Preserve [= attr_list]
Preserve the specified attributes (default: mode, ownership, timestamps), if possible additional attributes: context, links,
Xattr, all

-C same as -- preserve = Context

-- No-preserve = attr_list
Don't preserve the specified attributes

-- Parents
Use full source file name under directory

-R,-R, -- Recursive
Copy directories recursively

-- Remove-destination
Remove each existing destination file before attempting to open it (contrast with -- force)

-- Sparse = when
Control creation of sparse files

-- Strip-trailing-slashes remove any trailing slashes from each source
Argument

-S, -- symbolic-Link
Make symbolic links instead of copying

-S, -- suffix = suffix
Override the usual backup suffix

-T, -- target-directory = directory
Copy all source arguments into Directory

-T, -- no-target-directory
Treat DEST as a normal file

-U, -- Update
Copy only when the source file is newer than the destination file or when the destination file is missing

-V, -- verbose
Explain what is being done

-X, -- one-file-System
Stay on this file system

-Z, -- Context = Context
Set security context of copy to context

-- Help display this help and exit

-- Version
Output version information and exit

Usage: CP-parameter Option (f forced, R, recursive) Copied file directory

Related Article

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.