Linux switch directories, view files under Directories, file type descriptions, and view metadata information for files

Source: Internet
Author: User

This blog introduces several basic Linux commands, write if there are shortcomings, but also hope that readers are not hesitate to enlighten!

Switch directories

CD(changedirectory) Switch working directory

Syntax: CD [directory to switch]

CD : Enter the user's host directory (home)

CD ~ : Enter user's home directory (same as CD function)

CD- : Switch back and forth from the directory and current directory where the CD command was last executed

CD.. : Toggles the top level directory of the current directory

CD.. /.. : returns to the working directory on level two

cd/etc : Switch to/etc directory

Options:

- P : If the directory you want to switch to is a soft link, switch to the target directory where the soft link is pointing (for the concept of linking, I'll write it in a later blog)

650) this.width=650; "src=" https://s2.51cto.com/wyfs02/M01/99/F3/wKioL1lPWCeTi6BZAAFFL8y2Ick702.jpg "title=" 1.jpg "alt=" Wkiol1lpwceti6bzaaffl8y2ick702.jpg "/>


Linux File Type

F : Normal file, including text file (TXT) picture file (jpg, png ...) ) Web page file (HTML)

such as

D : Catalog File

650) this.width=650; "src=" https://s4.51cto.com/wyfs02/M02/99/F3/wKioL1lPWDORudjcAACcdiZXAaQ337.jpg "title=" 2.jpg "alt=" Wkiol1lpwdorudjcaaccdizxaaq337.jpg "/>


b : Block device Files

650) this.width=650; "src=" https://s1.51cto.com/wyfs02/M00/99/F3/wKiom1lPWD_xzaTDAACp6a-nMhY574.jpg "title=" 3.jpg "alt=" Wkiom1lpwd_xzatdaacp6a-nmhy574.jpg "/>


C : Character device files

650) this.width=650; "src=" https://s4.51cto.com/wyfs02/M01/99/F3/wKioL1lPWE2QqQt8AADyznhuMKw485.jpg "title=" 4.jpg "alt=" Wkiol1lpwe2qqqt8aadyznhumkw485.jpg "/>


L : Link File

650) this.width=650; "src=" https://s2.51cto.com/wyfs02/M01/99/F3/wKiom1lPWG7Q6-7wAAC74GHrKO4436.jpg "title=" 5.jpg "alt=" Wkiom1lpwg7q6-7waac74ghrko4436.jpg "/>


P : Pipeline File

650) this.width=650; "src=" https://s3.51cto.com/wyfs02/M01/99/F3/wKioL1lPWHrD-sa2AADIG8IiTPk211.jpg "title=" 6.jpg "alt=" Wkiol1lpwhrd-sa2aadig8iitpk211.jpg "/>


s : Socket file

650) this.width=650; "src=" https://s5.51cto.com/wyfs02/M02/99/F3/wKiom1lPWK3joAUVAADyLuSbfAs698.jpg "title=" 7.jpg "alt=" Wkiom1lpwk3joauvaadylusbfas698.jpg "/>


View Catalog Contents

ls (list) command to list directory contents

ls command to display a list of files for a specified directory

Syntax: LS [option ...] [Directory or file path ...]

Options:

-A : Displays all files in the current directory, including hidden files

-A : The function of the-a option is basically similar, but does not show "." Directories and ".." Catalogue

- L : Displays the file type and directory list in a long format (long), including permissions, size,

After the update time and other details, about the file type, permission information I will be in the following section detailed

Ls–l can also be written as "ll"

650) this.width=650; "src=" https://s2.51cto.com/wyfs02/M00/99/F3/wKioL1lPWLuClkQ9AAC5YYOAqjE052.jpg "title=" 8.jpg "alt=" Wkiol1lpwluclkq9aac5yyoaqje052.jpg "/>


Left-to-right first character "-": File type

From the second to the tenth character "rw-r--r--": access rights to a file

11th character "1": Number of times a file has been hard-linked

12th character "Root left": File owner (owner)

13th character "root Right": filegroup (Group)

14th character "235": Size of File

3 Month 18 15:43: Time the file was last modified

Last character "Test_file": File name

- H : Displays the size of the directory or file in a more user-friendly (human-readable) way

(KB, MB), the default size is in bytes (b), and this option needs to be combined with the "-l" option

Used together

- D : Display directory (directory) displays the properties of the current user itself instead of displaying the directory

, this option needs to be used in conjunction with the "-l" option

- I. : Displays the I node (inode) for each file

- R : Reverse Sort by file name

- R : Displays all content in the specified directory and its subdirectories in a recursive (Recursive) Manner

- S : Sort by file size

-id : Displays only the detailed properties of the current directory and does not display the contents of the directory

View metadata information for a file

Stat command to display file or file system status information (metadata information)

Syntax: stat [file or directory ...]

650) this.width=650; "src=" https://s2.51cto.com/wyfs02/M01/99/F3/wKioL1lPWMvQpmEYAAIB-JDx7OY736.jpg "title=" 9.jpg "alt=" Wkiol1lpwmvqpmeyaaib-jdx7oy736.jpg "/>

File : File name

Size : File Size

Blocks : Number of disk blocks occupied

IO Block : IO block size

Normal file: File type

Device : Your device

Inode : inode node number

Links : Number of times to be linked

Access (first): Access rights

Uid : Uid number and owner

Gid : Gid number and genus Group

Access (second): The last time the file was accessed

Modify : File modification Time

Change : Change time of File


Options:

- t: Display in a concise manner

- F : Add block device path after option, display file system status instead of file status

About the permissions of the file, I will write in a later blog

This article is from "ZYJTF Lone Cloud Twilight" blog, please be sure to keep this source http://zhangdaifu.blog.51cto.com/11848193/1941676

Linux switch directories, view files under Directories, describe file types, and view metadata information for files

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.