Liunx directory and file management (i)

Source: Internet
Author: User
Tags touch command

Liunx directory and file Management (i)

Requirements:

? Practice the basic commands for directory and file management.

U View and switch directories: PWD, CD, ls, Du.

Steps:

1. PWD command-view current working directory (Print working directory) 650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image002 "border=" 0 "alt=" clip_image002 "src=" http://s3.51cto.com/wyfs02/M01/77/59/ Wkiol1zmsr7gdgtjaaafygzi-yc676.png "" 244 "height="/>

2. CD command-switch working directory (change directory) 650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image004 "border=" 0 "alt=" clip_image004 "src=" http://s3.51cto.com/wyfs02/M00/77/59/ Wkiol1zmsr6xdhmraaalkvv0oey065.png "" 244 "height="/>

CD-: Return to the previous level

CD: Return to the root directory

CD ~: Return to the host directory

3. ls command-list displays directory contents

? -L: Displays a list of files and directories in long format, including details such as permissions, size, last update time, and so on. The LS command displays directory or file name information by default in short format when you do not use the-l option

? -A: Displays information about all subdirectories and files, including the name with the dot number "." Start with hidden directories and hidden files

? -A: The function of the-a option is basically similar, but there are two special hidden directories that do not display: "." Representing the current directory, "." for the parent directory. .”。

? -D: Display the properties of the directory itself instead of displaying the contents of the directory

? -H: Displays the size of the directory or file in a more user-friendly (Human) manner, with the default size in bytes and the-H option displayed as K, M, and so on. This option needs to be used in conjunction with the-l option.

? -R: Recursively (Recursive) all content in the specified directory and its subdirectories.

?--color: Distinguishes files in character mode by color, and if you use "-color=tty", the color scheme that is predefined by the terminal is used. This is generally true: Dark blue indicates a directory, white represents a generic file, green indicates an executable file, * * * indicates a device file, and red indicates a compressed file.

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image006 "border=" 0 "alt=" clip_image006 "src=" http://s3.51cto.com/wyfs02/M01/77/5B/ Wkiom1zmsk-qnxlsaaalzufwxn4160.png "244" height= "/>650" this.width=650; "style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image008 "border=" 0 "alt=" clip_image008 "src=" http://s3.51cto.com/wyfs02/M02/77/59/ Wkiol1zmsr-am0_5aaahxb3z7fo082.png "244" height= "/>650" this.width=650; "style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image010 "border=" 0 "alt=" clip_image010 "src=" http://s3.51cto.com/wyfs02/M01/77/5B/ WKiom1Zmslcaf8ldaaapnjrkm4m574.png "244" height= "/>650" this.width=650; "style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image012 "border=" 0 "alt=" clip_image012 "src=" http://s3.51cto.com/wyfs02/M00/77/59/ Wkiol1zmssczy2q3aaam9pf3970081.png "" 244 "height="/>

Experience Summary:

For frequently used long command lines, the alias alias mechanism can be simplified to improve the efficiency of use. For example, execute the following command to define a command alias named Myls, which is equivalent to executing the "LS–ALH" command when you Execute "Myls" later. as follows: 650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image014 "border=" 0 "alt=" clip_image014 "src=" http://s3.51cto.com/wyfs02/M01/77/59/ Wkiol1zmsshzjk4oaaah7rfjd_w540.png "" 244 "height="/>

4. Du command-Statistics directory and file space usage (Disk Usage)

? -A: All files are included when the disk space is occupied, not just the statistics directory.

? -H: Displays statistical results in a more humane way (by default in kilobytes, but not in units), with the-h option showing units such as K, M, and so on.

? -S: Only the total space (Summary) size of each parameter is counted, not the size of each subdirectory or file. 650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image016 "border=" 0 "alt=" clip_image016 "src=" http://s3.51cto.com/wyfs02/M00/77/59/ Wkiol1zmsshdbuzyaaajn0sohlw534.png "244" height= "/>650" this.width=650; "style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image018 "border=" 0 "alt=" clip_image018 "src=" http://s3.51cto.com/wyfs02/M00/77/5B/ Wkiom1zmslljilmraaa6jcomnno188.png "" 244 "height=" 137 "/>

U Create directories and files: mkdir, touch, Ln.

Steps:

1. mkdir command-Create a new directory (make directory) 650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image020 "border=" 0 "alt=" clip_image020 "src=" http://s3.51cto.com/wyfs02/M01/77/59/ Wkiol1zmssozwr48aaamtsnqsxe281.png "244" height= "/>650" this.width=650; "style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image022 "border=" 0 "alt=" clip_image022 "src=" http://s3.51cto.com/wyfs02/M00/77/59/ Wkiol1zmsspsc8v7aaat00fn3bm973.png "" 244 "height=" "/>

2. Touch command-Create empty file 650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image024 "border=" 0 "alt=" clip_image024 "src=" http://s3.51cto.com/wyfs02/M01/77/5B/ Wkiom1zmslsbfiv7aaawfguczla465.png "" 244 "height="/>

3. ln command-Create link file 650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image026 "border=" 0 "alt=" clip_image026 "src=" http://s3.51cto.com/wyfs02/M02/77/5B/ Wkiom1zmslsxix4yaaauw5gzgjq487.png "" 244 "height="/>

The default is to create a hard link, and if you need to create a soft link, you must explicitly specify it in conjunction with the "-S" option. hard links can be updated synchronously . Basic usage Format:

LN [-S] source file or directory ... .. link file or destination location

U copy, delete, move directories and files: CP, RM, MV.

1. CP command-copy file or directory

Basic usage Format:

CP [ options ] ... source file or directory ... .. directory files or directories

? -F: Override the target file or directory with the same name without a reminder, and force the copy directly.

? -I: Overwrite the target file or directory with the same name is a reminder user confirmation (Interactive, interactive).

? -P: Keep (Preserve) The source file permissions, the owner and the time tag, and so on when copying.

? -r: This option must be used when copying directories, which means that all files and subdirectories are copied recursively. 650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image028 "border=" 0 "alt=" clip_image028 "src=" http://s3.51cto.com/wyfs02/M00/77/59/ Wkiol1zmssxttl5maaal9xyr4va728.png "244" height= "/>650" this.width=650; "style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image030 "border=" 0 "alt=" clip_image030 "src=" http://s3.51cto.com/wyfs02/M01/77/59/ Wkiol1zmsswr1eznaaapexf2nsa975.png "" 244 "height="/>

2. RM command-Delete (remove) file or directory

? -F: Remove the file or directory without a reminder, and force the deletion directly.

? -I: Alerts users to confirm when deleting files or directories.

? -r: This option must be used when deleting Nuru, which means recursively deleting the entire directory tree (should be used sparingly). 650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image032 "border=" 0 "alt=" clip_image032 "src=" http://s3.51cto.com/wyfs02/M02/77/59/ Wkiol1zmssajg55yaaamwth5d9e528.png "244" height= "/>650" this.width=650; "style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image034 "border=" 0 "alt=" clip_image034 "src=" http://s3.51cto.com/wyfs02/M01/77/5B/ Wkiom1zmslbg8lzpaaamz696dli538.png "" 244 "height="/>

3. MV command-move file or directory

If the target location is the same as the source location, the effect is equivalent to renaming the file or directory. Basic usage Format:

mv [ options ] ... .. source file or directory ... .. target file or directory 650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image036 "border=" 0 "alt=" clip_image036 "src=" http://s3.51cto.com/wyfs02/M00/77/59/ Wkiol1zmssecvk6baaasdluunve029.png "244" height= "/>650" this.width=650; "style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image038 "border=" 0 "alt=" clip_image038 "src=" http://s3.51cto.com/wyfs02/M00/77/59/ Wkiol1zmssfjqomyaaarpzyuj7k312.png "" 244 "height="/>

U Find directories and files: which, find.

1. Which command-find the Linux command file and display the location 650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image040 "border=" 0 "alt=" clip_image040 "src=" http://s3.51cto.com/wyfs02/M01/77/5B/ Wkiom1zmsljdsx3faaatnkwrwvs857.png "" 244 "height="/>650) this.width=650; style= Background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image042 "border=" 0 "alt=" clip_image042 "src=" http://s3.51cto.com/wyfs02/M02/77/59/ Wkiol1zmssizpvbdaaarp2bvnqc411.png "" 244 "height="/>

2. Find command-Locate a file or directory

Basic usage Format:

Find [ look in ] [ find criteria Expression ]

? Find by name: keyword "-name", based on the name of the target file to find, allow the use of "*" and "? "Wildcard character.

? Find by File size: The keyword is "-size", based on the size of the catalog file to find, generally use "+", "-" number is set to more than or less than the specified size as the search criteria. Common capacity units include K (note is lowercase), M, G.

? by file owner lookup: the keyword is "-user", depending on whether the file belongs to the target user to find.

?Find by file type:The keyword is: "-type", based on the type of file to find, the type here refers to ordinary file (f), directory (d), block device file (b), character device file (c), and so on. A block device is a device that reads data in chunks (such as hard disks, memory, and so on), while a character device refers to a device that reads data by a single character (such as a keyboard, mouse, and so on).650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image044 "border=" 0 "alt=" clip_image044 "src=" http://s3.51cto.com/wyfs02/M00/77/59/ Wkiol1zmssmblnq4aaakeg59zki654.png "" 244 "height="/>650) this.width=650; style=; background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image046 "border=" 0 "alt=" clip_image046 "src=" http://s3.51cto.com/wyfs02/M02/77/5B/ Wkiom1zmslmci25maaalgxvgj7m425.png "244" height= "/>650" this.width=650; "style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image048 "border=" 0 "alt=" clip_image048 "src=" http://s3.51cto.com/wyfs02/M02/77/5B/ WKiom1Zmslqzotaaaaauwcppz_8444.png "" 244 "height="/>

? Practice commands to help get information.

You see the Help information for the find command using the man 、--assist option to compare their similarities and differences.

Find--help :

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image050 "border=" 0 "alt=" clip_image050 "src=" http://s3.51cto.com/wyfs02/M00/77/59/ Wkiol1zmssut6wbnaabtmdnlgag326.png "" 244 "height=" 164 "/>

Mans Find :

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image051 "border=" 0 "alt=" clip_image051 "src=" http://s3.51cto.com/wyfs02/M01/77/5B/ Wkiom1zmslzgd3kdaabj3kuwhjw121.png "" 244 "height=" 165 "/>

You use the Man tool to view the man's own manual album information and save it as a man.txt text file. 650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image053 "border=" 0 "alt=" clip_image053 "src=" http://s3.51cto.com/wyfs02/M01/77/59/ Wkiol1zmssyrx70zaaaiuynqog4308.png "" 244 "height="/>

You use the Man tool to view the wget download tool, the date Day Display tool's manual page information, and the date command to output time information in the format "Yyyy-mm-dd hh:mm" (Execute command date+ "%f+%r" or date+ "%y-%m-%d%h:%m").

View wget Download Tool:

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image055 "border=" 0 "alt=" clip_image055 "src=" http://s3.51cto.com/wyfs02/M01/77/5B/ Wkiom1zmsl3bdv0gaabf9ewl5-w473.png "" 244 "height=" 137 "/>

View Date Date Tool:

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image057 "border=" 0 "alt=" clip_image057 "src=" http://s3.51cto.com/wyfs02/M02/77/5B/ Wkiom1zmsl6sr0l0aaark8dxwng920.png "" 244 "height=" 137 "/>

input Date command to view date time:

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image059 "border=" 0 "alt=" clip_image059 "src=" http://s3.51cto.com/wyfs02/M02/77/59/ Wkiol1zmss7jupcoaaaix26oc2k243.png "" 244 "height="/>

U View system catalog/sbin,/bin,/usr/bin,/usr/s650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image061 "border=" 0 "alt=" clip_image061 "src=" http://s3.51cto.com/wyfs02/M00/77/5B/ Wkiom1zmsl_g9hvfaaahuiy0liw559.png "" 244 "height=" 121 "/>bin what commands or programs, the teaching materials do not learn the commands, use the Man tool to see their help, understand the role of these commands and how to use them.

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image063 "border=" 0 "alt=" clip_image063 "src=" http://s3.51cto.com/wyfs02/M00/77/59/ Wkiol1zmstcqntieaaaslfqolle732.png "244" height= "/>650" this.width=650; "style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image065 "border=" 0 "alt=" clip_image065 "src=" http://s3.51cto.com/wyfs02/M01/77/5A/ Wkiol1zmsthc3beuaaarlpmuqzs702.png "244" height= "/>650" this.width=650; "style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image067 "border=" 0 "alt=" clip_image067 "src=" http://s3.51cto.com/wyfs02/M02/77/5B/ Wkiom1zmsmgwtpo0aaAetn_fqfy254.png "" 244 "height="/>

Liunx directory and file Management (i)

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.