In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Most people do not understand the knowledge points of this article, "what is the method of Linux copying files?" so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "what is the method of Linux copying files" article.
The Linux cp (English full spelling: copy file) command is mainly used to copy files or directories.
The cp command is used to copy one or more source files or directories to a specified destination file or directory. It can copy a single source file into a specific file with a specified file name or an existing directory. The cp command also supports copying multiple files at the same time, and when copying multiple files at a time, the target file parameter must be an existing directory, otherwise an error will occur.
Syntax cp (option) (parameter) option
-a: the effect of this parameter is the same as specifying the "- dpR" parameter at the same time
-d: when copying a symbolic connection, the destination file or directory is also established as a symbolic link and points to the original file or directory connected to the source file or directory
-f: forcibly copy a file or directory, regardless of whether the target file or directory already exists
-I: ask the user before overwriting existing files
-l: establish a hard connection to the source file instead of copying the file
-p: preserve the attributes of the source file or directory
-Rbarb r: recursive processing that processes all files in the specified directory with subdirectories
-s: establish a symbolic connection to the source file instead of copying the file
-u: after using this parameter, the file will be copied only when the change time of the source file is newer than that of the target file, or when the target file with corresponding names does not exist.
-S: when backing up a file, replace the default suffix of the file with the specified suffix "SUFFIX"
-b: back up the target file before overwriting the existing file destination
-v: displays the actions performed by the command in detail. -a: this parameter has the same effect as specifying the ""-dpR "" parameter at the same time; "- d: when copying a symbolic connection, the target file or directory is also established as a symbolic connection and points to the original file or directory connected to the source file or directory;"-f: forcibly copy the file or directory, regardless of whether the target file or directory already exists; "- I: ask the user before overwriting an existing file. "- l: establish a hard connection to the source file instead of copying the file;"-p: retain the attributes of the source file or directory; "- Rbinr: recursive processing, processing all files in the specified directory with subdirectories;"-s: establish a symbolic connection to the source file instead of copying the file "- u: after using this parameter, the file will be copied only when the change time of the source file is longer than that of the target file, or when the target file with the corresponding name does not exist;"-S: when backing up the file, replace the default suffix of the file with the specified suffix "SUFFIX"; "- b: back up the target file before overwriting the existing file destination;"-v: show the operation performed by the command in detail.
Parameter source file: make a list of source files. By default, the cp command cannot copy directories, and if you want to copy directories, you must use the-R option
Target file: specify the target file. When the Source File is multiple files, the destination File is required to be the specified directory.
If an instance copies a file to an object file and the target file already exists, the contents of the target file will be corrupted. All parameters in this command can be either absolute or relative pathnames. It usually comes in handy. Or dots.. In the form of. For example, the following command copies the specified file to the current directory:
Cp.. / mary/homework/assign. The directories specified by all target files must already exist and cannot be created by the cp command. If you do not have permission to copy files, the system displays an error message.
Copy the file file to the directory / usr/men/tmp and rename it file1
Cp file / usr/men/tmp/file1 copies all files and their subdirectories under the directory / usr/men to the directory / usr/zh
Cp-r / usr/men / usr/zh interactively copies all .c files starting with m in the directory / usr/men to the directory / usr/zh
Cp-I / usr/men muse.c / usr/zh We use the cp command under Linux to copy files, sometimes we need to overwrite some files with the same name, and when we overwrite files, we will have a hint: we need to press Y constantly to make sure that the overwrite is performed. It's okay to have a small number of files, but hundreds of them are estimated to vomit blood by Y, so I summed up a method for a long time:
Cp aaa/* / bbb copy all the files under the aaa directory to the / bbb directory. If there are files with the same name as aaa in the / bbb directory, press Y to confirm and skip the subdirectories under the aaa directory.
Cp-r aaa/* / bbb still needs to press Y to confirm the operation this time, but the subdirectories are not ignored.
Cp-r-an aaa/* / bbb still needs to press Y to confirm the operation, and the aaa directory and subdirectories and file attributes are also passed to / bbb.
\ cp-r-an aaa/* / bbb succeeded without prompting to press Y, passed directory attributes, and did not skip directories.
The above is about the content of this article on "what is the method of Linux copying files". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.
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.