Linux file basic operation management 1. use the cp command to copy files or folders common parameters of the cp Source File (folder) target File (folder):-r recursively copy the entire directory tree-v to show details 1. copy the file: eg: cpwenjianwenjian-2 in the same folder... linux file basic operation management 1. use the cp command to copy files or folders common parameters of the cp Source File (folder) target File (folder):-r recursively copy the entire directory tree-v to show details 1. copy the file: eg: cp wenjian wenjian-2 in the same folder and copy the file named "wenjian" under the same folder, and the copied file name is "wenjian-2" 2. copy the file eg: cp wenjian linuxcast.net/in different folders and copy the file named "wenjian" to the linuxcast.net folder. the file name remains unchanged after the copy. 3. copy a folder using the cp Command: The-r command must be added to the copy folder. Eg: cp-r linuxcast.net linuxcast. net2 not only copies the linuxcast.net folder, but also copies all the files in the folder to linuxcast. to display the details of the copy, add-v eg: cp-r-v linuxcast.net linuxcast to the parameter. net3 or cp-rv linuxcast.net linuxcast. net3 will display detailed information. II. move or rename a file or directory 1. use the mv command to move or rename the file or directory format: Target Directory of the mv file. for example: mv linuxcast linuxcast.net/, move the file named "linuxcast" under the current directory to the linuxcast.net folder, this file does not exist in the current directory. Its effect is similar to "cutting ". If you specify a file name, you can rename the file eg: mv linuxcast-2 linuxcast.net/cast1 and move the file named "linuxcast-2" under the current directory to the linuxcast.net folder, and rename the moved file as "cast ". if you do not change the file directory, rename the file mv file name. for example: mv linuxcast liangjin, rename the file named "linuxcast" in the current directory to "liangjjin ". therefore, if you do not specify a directory, directly move it under the current directory to rename it. III. create and delete files 1. you can use the touch command to create an empty file or update the file time. the touch file name is created in the current directory. The touch folder Interactive-r recursively deletes all contents in the directory.-f force deletes, no warning prompt (be careful, impulsive is the devil) format: When the rm file name is deleted from the folder, add the-r parameter format: rm-r folder name eg: rm-r linuxcast.net deletes all the files in linuxcast.net along with the folder without any prompt. This operation is dangerous. important files may be wiped out in an instant. We can add the-I parameter. -I is used to interactively delete files and folders (each time you delete a file system, you will be asked if you are sure to delete it ). For example: rm-ri linuxcast.net/, delete the files in the linuxcast.net folder one by one. you will be asked for comments every time you delete the files. 4. create or delete a directory. use the mkdir command to create a directory. use the rmdir command to delete an empty directory and run the rm-r (-f) command.
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