cp command The function of this command is to copy the given file or directory to another file or directory, just like the copy command under DOS, it is very powerful. Syntax: cp [options] source file or directory object file or directory Description: This command copies the specified source file to the target file or copies multiple source files to the target directory. The options for this command have the following meaning: - a This option is usually used when copying directories. It preserves links, file attributes, and recursively copies the directory, which acts as a combination of dpR options. - d Keep the link when copying. - f Delete an existing target file without prompting. - The i and f options are the opposite, and a prompt will be given to the user before the target file is overwritten. The target file will be overwritten when answering y, which is an interactive copy. - p At this time, in addition to copying the contents of the source file, cp also copies its modification time and access rights to the new file. - r If the given source file is a directory file, cp will recursively copy all subdirectories and files in that directory. The target file must be a directory name at this time. - l Do not make a copy, just link the file. It should be noted that in order to prevent the user from inadvertently destroying another file with the cp command, if the user-specified target file name is an existing file name, the file will be newly copied after copying the file with the cp command. The source file is overwritten, so it is recommended that users use the i option when copying files using the cp command. $ cp - i exam1.c /usr/wang/shiyan1.c This command copies the file exam1.c to the /usr/wang directory and renames it to shiyan1.c. If you don't want to rename, you can use the following command: $ cp exam1.c /usr/wang/$ cp - r /usr/xu//usr/liu/All files in the /usr/xu directory and their subdirectories Copy to the directory /usr/liu. Mv command Users can use the mv command to rename a file or directory or move a file from one directory to another. This command is like the combination of ren and move under DOS. Syntax: mv [options] source file or directory object file or directory description: depending on the second parameter type in the mv command (is the target file or the target directory), the mv command renames the file or moves it to a new one. In the catalog. When the second parameter type is a file, the mv command completes the file renaming. At this time, the source file can only have one (or the source directory name), and it renames the given source file or directory to the given one. The name of the target file. When the second parameter is an existing directory name, there may be multiple source files or directory parameters. The mv command moves the source files specified by each parameter to the target directory. When moving a file across a file system, mv copies first, then the original file is deleted, and the link to the file is lost. The meaning of each option in the command is: - I Interactive mode operation. If the mv operation will result in an overwriting of the existing target file, the system asks whether to rewrite, and asks the user to answer y or n, so as to avoid accidentally overwriting the file. - f Prevents interaction. No indication is given when the mv operation wants to overwrite an existing target file. After this option is specified, the i option will no longer work. If the given target file (not the directory) already exists, the contents of the file will be overwritten by the new file at this time. To prevent users from using the mv command to break another file inadvertently, it is recommended that users use the i option when moving files using the mv command. It should be noted that the results of mv and cp are different. Mv seems to file "moving", the number of files increases at the end, and cp copies the file, the number of files increases. Example 1: Move all files in /usr/xu to the current directory (indicated by “.”): $ mv /usr/xu/* . Example 2: Rename the file wch.txt to wjz.doc $ mv wch.txt wjz.doc
Today, I have brought the steps of adding static routes for Linux, I hope to help my friends! 1. Add
The Go language (ie Golang) is a programming language originally developed by Google. It has severa
Because the installation of debian uses a minimal installation, the default installation in Chinese,
1 Start vSphere Client2 Start Virtual Machine [Right-click on VM, select Power —>Open] and
The correct way to restore EXT3 Superblock under Linux
8 tips to make you a super Linux end user
Linux system UMASK usage details
Linux centos shutdown and restart command detailed and actual
Nginx SSL/TLS configuration for “A+” Qualys SSL Labs ratin
Linux adsl dialing and sharing Internet
Linux DDOS attack on Windows system
Linux system information view command
How to view the current Linux version
Redhat-5.4 U disk installation grub configuration diagram tutorial
After Win10 connects to wifi, how to solve the problem of no internet access?
Pirated Windows 7 patch update faces desktop blackening
Reasons and solutions for slower copy files in Vista
Win7 system Google browser is maliciously bound to hao123 home page how to do
Windows 7 system: WMPlayer 12 new features
WPS document simplification conversion graphic tutorial
Win10 built-in application uninstalled how to recover A stroke Win10 built-in application
Win7 system wants to take pictures, but can't find the camera on my computer