In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Cp copies files and directories
Cp SRC DEST
SRC is a file:
If the target does not exist:
Create a new DEST and populate the contents of SRC into the DEST
If the target exists:
If DEST is a file: overwrite the contents of SRC to DEST
For security reasons, the-I option is recommended for the cp command
If DEST is a directory:
Create a new file with the same name as the original file under DEST, and populate the contents of SRC into the new file
SRC...: multiple files
DEST must exist and be a directory. Other situations will cause errors.
SRC is the directory: use option at this time:-r
If DEST does not exist:
Then create the specified directory and copy all the files in the SRC directory to DEST
If DEST exists:
If DEST is a file: error reported
If DEST is a directory:
-I: interactive
-r,-R: recursively copy the directory and all its internal contents
-a: archiving, equivalent to-dR--preserv=all
-d:--no-dereference-- preserv=links does not copy the original file, only the link name
-- preserv [= ATTR_LIST] various attributes
Mode: permission
Ownership: belong to the main group
Timestamp: timestamp
Links: link
Xattr:
Context: environment
All: all of them
-p: equivalent-- preserv=mode,ownership,timestamp
-v:-- verbose to view the replication process. Do not add-v for background execution.
-f:-- force coercion
Practice
1. Use the alias command to back up all files under the / etc/ directory to a separate new directory under / testdir/ every day. The new directory format is required to be backupYYYY-mm-dd, and the backup process is visible.
2. First create the / testdir/rootdir directory, and then copy all the files under / root to this directory, and request to retain the original permissions.
Cp-r-preserv=mode / root/* / testdir/rootdir
This command cannot be executed because / root/ in / root/* represents files or directories below root, and * represents all files and directories, because / testdir/rootdir is a file or directory that has not yet been created, and all files cannot be copied to directories or files that do not exist, and existing files cannot be copied successfully, only existing directories can be copied successfully.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.