Learn Linux from scratch (ls command)

Source: Internet
Author: User

Linux has been learning for two years, but still a small white one. Used a lot of commands, but many did not remember, the foundation is not solid, to a large extent, is not taking notes, muddle through.

From today onwards, start to organize Linux notes.

Linux has--help this option for every command, which is the main way we learn commands.

ls command, which is typically used to view files under a file folder.

LS has no parameters and displays the non-hidden files in the current directory by default.

LS can be followed by the file directory, relative path and absolute path can be.

For example:

[Email protected]:~$ ls/home/gaozy/

[Email protected]:~$ ls.

The effect is the same. (. Represents the current directory,.. Represents the previous level of the directory).

You can also add parameters after LS

[Email protected]:~$ ls-a/home/gaozy/

-A represents all files (this includes hidden files).

Generally used parameters are

-a lists all files and directories (including hidden files and directories)

-L Lists all information about the file (probably the following)

Drwxr-xr-x 2 gaozy gaozy 4096 December 13 21:43 Desktop/

Drwxr-xr-x the first field, which represents the file type and permissions.

We can be divided into four segments D rwx r-x r-x

File type owner user group other user rights

D represents a folder,-represents a normal file, L indicates a connection, B represents a storage interface device, and C indicates a serial interface device (many such devices in/dev)

BRW-RW----1 root disk 8, 5 December 21:55 Sda5

CRW-------1 root root 10, 55 December 21:56 VMCI

RWX respectively represents the read, write, execute permissions,-the delegate does not have the permission, the position fixed cannot be reversed.

The folder must have EXECUTE permission before it can enter.

The folder must have Read permission to view it.

The folder must have write permission to create the file.

The second field 2 indicates that there is a file connection on this file, and 1 represents only himself. (ln creates a link)

The third field gaozy the user to which the file belongs.

The fourth field gaozy the user group to which the file belongs.

Fifth field 4096 the capacity of a document.

Sixth field December 13 21:43 file creation time or last modified time.

Seventh field Desktop/document name

-R Recursive Print subdirectory (this is what I just saw, I seldom use, usually with tree).

Other parameters are not much to say, you can use: LS--help command to view.

When writing ls-l, it is generally written in LL.

LA is equivalent to ls-a.

Learn Linux from scratch (ls command)

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.