Linux common shell commands ls and linuxshell commands ls

Source: Internet
Author: User

Linux common shell commands ls and linuxshell commands ls

Ls: view the file name and directory. Usage: $ ls [Option]

1. $ ls

Directly enter the ls command to list all files and directories in the current directory without displaying details, such as type, size, and date permissions.

2. $ ls-l

-L option. One record is displayed on each line and the file and directory information is displayed in a long list, including the file type, size, modification date and time, permissions, users, and groups.

If the following content is displayed:

Drwxr-xr-x 2 userName groupName 4096 Sep 18 10: 51
Drwxr-xr-x 2 userName groupName 4096 Jul 2 07:47 Documents ents
Drwxr-xr-x 2 userName groupName 4096 Jul 2 07:47 Downloads

-Rw-r -- 1 userName groupName 0 Sep 18 :43 hello.txt

The output line above contains seven fields, each of which has different meanings:

Field 1: file type and permissions. The first character indicates the file type. The specific conditions include: d: Directory;-: common file; s: Socket file; l: Link file.

Rwxr-xr-x indicates the File Permission.

Field 2: Number of links. 1 indicates that only one file is linked to this file.

Field 3: Owner

Field 4: User Group

Field 5: file size, in bytes

Field 6: last modification date of the file

Field 7: File Name

 

3. $ ls-lh

-The lh option can display the file size as a regular reading style, for example:

Drwxr-xr-x 2 lipan 4.0 K Sep 18 10: 51

 

4. $ ls-F

-F option to classify different file types with different special characters

Init/linux-sound-base/ufw/
Klibc-P2s_k-gf23VtrGgO2_4pGkQgwMY.so * lsb/x86_64-linux-gnu/
Libcryptsetup. so.4 @ modprobe. d/xtables/hello.txt

/: Indicates the Directory

@: Indicates the link file.

*: Indicates the executable file.

None: indicates a common file.

 

5. $ ls-R

-R option to recursively list the content of a directory

 

6. $ ls-ls

-Ls option to list files and directories in descending order of file size in long list format)

 

7. $ ls-

-Option a lists all files and directories including hidden files or directories, including "." (current directory) and "." (parent directory)

 

8. $ ls-

-A option to list all files and directories including hidden files or directories, excluding "." (current directory) and "." (parent directory)

 

9. $ ls-n

-N option. output is similar to-l option, but uid and gid are used instead of owner and user group.

 

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.