Linux users can use cp and scp in the Linux kernel system without using other third-party tools when copying files. How to do this? Let's take a look at how to use the cp command to copy files and folders.
Copy method:
Name: cp
Access: All users
use:
cp [ ,null,null,0],Options] source dest
cp [options] source... directory
Description: Copy one file to another file or copy several files to another directory.
-a, --archive is equal to -dR --preserve=all
--backup[=CONTROL Create a backup for each existing object file
-b Similar to --backup but does not accept arguments
--copy-contents in recursive processing is to copy special file contents
-d equals --no-dereference --preserve=links
-f, --force Remove the target file if it cannot be opened and try again (you don't need to select this option when the -n option
exists)
-i, --interactive pre-overwrite query (make the previous -n option invalid)
-H Follow the command line symbolic link in the source file
-l, --link link file without copying < Br>
-L, --dereference always follow symbolic links
-n, --no-clobber Do not overwrite existing files (make the previous -i option invalid)
-P, --no-dereference does not follow symbolic links in source files
-p equals --preserve=mode, ownership, timestamps
--preserve[=attribute list hold Specified attribute (default: mode , ownership, timestamp), if
may maintain additional properties: environment, link, xattr, etc.
-R, -r, --recursive Copy all directories in the directory and directory< Br>
Example:
.Copy files, copy files only if the source file has a new modification time than the destination file
cp -u -v file1 file2
Copy file file1 to file file2
cp file1 file2
. Copy file file1 to file file2 in interactive mode
cp -i file1 file2
Copy the file file1 to file2, because the destination file already exists, so specify the mode to use forced copy
cp -f file1 file2
. Copy the directory dir1 to the directory dir2
cp -R file1 file2
. Also copy the file file1, file2, file3 and directory dir1 to dir2
cp -R file1 file2 file3 dir1 dir2
.Retain file attributes when copying
cp -p a.txt tmp/
.Retaining the directory structure of files when copying
c p -P /var/tmp/a.txt ./temp/
.Generate backup files when copying
cp -b a.txt tmp/
. Generate backup file, tail ~1~ format
cp -b -V t a.txt /tmp
. Specify backup file tail
cp -b -S _bak a.txt /tmp
If you don't like to use third-party copy tools, try copying files and folders using the cp command. I believe this feature will bring you some surprises.
Debian system, some packages can not be deleted for some reason, very troublesome when cleaning up t
zoneminder is a free open source video surveillance software under Linux. Many peop
When doing Linux command operations, sometimes many directories are searched for, and these director
SecureCRT is a terminal emulation software that is used in a variety of systems. Ho
How to modify the default timeout time of sudo in Ubuntu system?
Git Workflow and Basic Operations in Linux
Linux network card binding setting method
Two ways to remove pdf passwords from Linux
How to enter the command line after the Linux system GUI starts
Linux setitimer function operation skills
What are the SELinux security mechanisms?
How can Ubuntu users not use the sudo command?
How to compile and install Mono notes in Linux system
The method of configuring OpenWRT routing is detailed
How to mount iPhone under Arch Linux system
Linux system how to switch the foreground process and background process
Ghost system CD burning tutorial graphic version Nero
Win8 KMS activation principle detailed
openSUSE upgrade to version 13.2 of the method
Win8 will automatically open a bing page every time you connect to the network
PPT animate also plays with rotation.
The most convenient way to access XP in Win7 on LAN
Windows7 upgrade has a loophole 2460 yuan flagship version of the free