Linux file management and operation command accumulation
Source: Internet
Author: User
Most of the time we spent in Linux is operating on Linux files, so I have accumulated some common file management operation commands in Linux for ease of use at any time. The details are as follows: 1. create a command: touch example: touchskxiao. xml description: creates a file named skxiao. xml...
Most of the time we spent in Linux is operating on Linux files, so I have accumulated some common file management operation commands in Linux for ease of use at any time. The details are as follows: 1. create a command: touch example: touch skxiao. xml description: creates a file named skxiao. xml 2. delete command: rm example: rm-r/home/shenkxiao/description: delete all files under/home/shenkxiao/3. copy command: cp example: cp skxiao. xml/home/shenkxiao description. copy the xml file to the/home/shenkxiao Directory. 4. run the following command: mv example: mv skxiao. xml skxiao. xml_bak_20120331 description: the skxiao under the current directory. the xml file is moved to the current directory and renamed as skxiao. xml_20120331 5. link command: ln example: ln-s skxiao. xml link-to-skxiao.xml description: creates a symbolic link named link-to-skxiao.xml that points to the source file skxiao. xml 6. search command: find example: find. -atime 7: find the file that has not been accessed in the current directory for at least seven days. example: find. -name core-exec rm {}\; note: delete the file named core in the current directory and delete it. example: find. -name '*. xml '-size-100 k description: delete the current directory. file www.2cto.com 7 with the end of xml less than KB, compression command: gzip example: gzip skxiao. xml description: compresses the file skxiao in the current directory. xml Example: gzip-d skxiao.xml.gz description: decompress the skxiao.xml.gz file. example: gzip-9 *. xml description: use the maximum compression effect method for all. compress the file ending with xml 8. create a subdirectory: mkdir example: mkdir-p/temp/shenkxiao/linux/filecmd description: use the-p parameter to create/temp/shenkxiao/linux/filecmd 9 and delete the subdirectory: rmdir example: rmdir-p/temp/shenkxiao/linux/filecmd description: use the-p parameter to delete/temp/shenkxiao/linux/filecmd (note: use rm-r to replace this command) 10. display the current working directory: pwd 11 and the tape file archiving command: tar example: tar-cf 1.tar 2.txt description: Create a compressed file named "1.tar.gz". example: tar-cvzf 1.tar.gz temp description: Create a 1.tar.gz compressed file that contains all the contents in the temp directory, run the-v option to view command execution. example: tar-xvzf 1.tar.gz description: extract the file 1.tar.gz (note: tar is one of the few Linux/Unix tools that require the option sequence, if you use tar-xvfz 1.tar.gz, it will fail because-f must be followed by the file name.) example: tar-xvzf/dev/fd0 description: decompress the archive file from the disk 12. run the "cat" command to merge files. for example: cat/etc/passwd/etc/group: view examples of passwd and group files in/etc: cat/etc/passwd/etc/group> users-and-groups.txt description: combine the passwdand groupfile to the users-and-groups.txt File example: cat/etc/hosts> users-and-groups.txt description: add/etc/hosts content to users-and-groups.txt 13. split the screen to display the file content: more example: ls | more/description: view the/sub-directory list www.2cto.com 14 displayed by the ls command on each split screen. Disk operation tool: du example: du-sh. note: List all subdirectories and space occupied by files in the current directory. 15. find the directory where the file is located. Command: which example: which rm description: find the directory in which the rm command is saved. 16. find the program storage location. Command: whereis example: whereis grep description: find the program location of the grep command, the source program and its user manual storage location 17, release the disk space command: df example: df-h. note: the idle space on the hard drive where the current working subdirectory is located is provided. 18. synchronize disk command: sync example: sync; sync description: ensure that the content in the cache is written to the disk from the column in Shenkxiao.
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