search
HomeSystem TutorialLINUXThe principle and usage of ll command to view directory information list in Linux

Linux 中 ll 命令查看目录信息列表的原理与使用方法

Study and summarize the document yourself. It’s a bit messy, don’t blame me

1. What does the total dose in Linux mean?

In Linux, we often use the ll command (ls-l) to view the directory information list, see the picture on the right:

查看用户的命令Linux_linux的chmod命令_打开终端的命令Linux

In the picture above, what does "Total 92" refer to? The "total" here, which can also be called "total dosage" or "total", refers to the number of blocks used in the directory. How is this number of blocks estimated? See picture on the right:

打开终端的命令Linux_查看用户的命令Linux_linux的chmod命令

The value on the right side of the above figure is the sum of the number of blocks (number of blocks) occupied by directories and files, 4x8+40+12+8=92, which is equal to "total 92", among which, the "ll-s" command also It can be written as "ls-ls" or "ls-l--size", and use "ls--help" to view the ls command parameter information, see the picture on the right (partial screenshot):

Note that "-s" here is capitalized, and the size of each file is listed in blocks.

To sum up, the "total" value in the ll or ls-l query results refers to the total number of blocks occupied by all files and subdirectories in the directory.

2. Linux return to root directory command

1. cd.. means to go to the upper directory;

2. cd-, means to return to the previous directory, similar to windows return;

3. cd/ means returning to the root directory.

4. cdlinux chmod command, return to normal user

查看用户的命令Linux_打开终端的命令Linux_linux的chmod命令

1. The command to switch users is: su+username

2. Switch from ordinary user to root user: sudosu

3. Return to the original user: exit command or logout, or ctrl+d

4. If you want to switch to the working environment of a new user: su-username such as su-root

5.# represents ordinary users, $ represents super users. That is root user

3. Linux file permissions

There are three types of file permissions: read (r), write (w) and execute (x). In addition to being represented by r, w and x, we can also use two's complement numbers to represent the three permissions. It is represented by a 3-digit two's complement number. A permission corresponds to a two's complement bit. If the bit is 1, it means that you have this permission. If the bit is 0, it means you do not have this permission, as shown in Table

打开终端的命令Linux_linux的chmod命令_查看用户的命令Linux

If you have done microcontroller development, you will also find that the three permissions r, w and x are the same as the register bits on the microcontroller

By different combinations, you can get different two's complement numbers and eight's complement numbers. 3-digit permissions can create 8 different permission combinations, as shown in the table

linux的chmod命令_打开终端的命令Linux_查看用户的命令Linux

The eight's complement number corresponding to the permission is the multiplication of the bits corresponding to each permission. For example, the permission rwx is 4+2+1=7. The permissions of the following file test.c are "rw-rw-r--", so its ten's complement representation is: 664.

In addition, we also started to use a, u, g and o to indicate the ownership of files, and =, + and - to indicate changes in file permissions,

查看用户的命令Linux_打开终端的命令Linux_linux的chmod命令

linux的chmod命令_查看用户的命令Linux_打开终端的命令Linux

For the file test.c, we want to change its ownership user (zuozhongkai) to have executable permissions on it, so we can

Use: u+x. If you want to set the owned user and its user group to have executable permissions on it, you can use: gu+x.

1. Permission management commands

Use Shell to operate file permission management, mainly using the two commands "chmod" and "chown",

Permission change command chmod

The command "chmod" is used to change the permissions of files or folders. The permissions can be represented by the numbers mentioned above or they can be

is represented by letters, and the command format is as follows:

chmod[parameter][file name/directory name]

The main parameters are as follows:

-c is similar to the "-v" parameter, but only the modified part is echoed.

-f does not display error messages.

-R recursively processes all files in the specified directory and their sub-file directories together.

查看用户的命令Linux_打开终端的命令Linux_linux的chmod命令

-v displays the execution process of the instruction.

Let's first learn how to use the command "chmod" to modify the permissions of a file in commonly used Linux systems and create a

in the user root directory.

File mytest, then check its default permissions,

We created a file: mytest. The default permissions of this file are "rw-rw-r--". We changed its permissions to "rwxrw-rw". The corresponding number is 766. The operation is as follows:

查看用户的命令Linux_linux的chmod命令_打开终端的命令Linux

Earlier we used numbers to change permissions. Let’s use letters to change permissions.

打开终端的命令Linux_查看用户的命令Linux_linux的chmod命令

File owner change command chown

The chown command is used to change the owner user or user group of a file or directory. The command format is as follows:

chown[parameter][username.][filename/directory]

where [username.] indicates the user or user group to which the file or directory is to be changed. The user name and group name are

Separated by ".", either the user name or group name can be omitted. The main parameters of the command are as follows:

-c has a similar effect to -v, but only the modified part is displayed.

打开终端的命令Linux_查看用户的命令Linux_linux的chmod命令

-f does not display error messages.

-h only processes all files and subdirectories in the specified directory.

-v displays the processing process. Create a test file in the user root directory and check the user and user group to which the folder belongs

linux的chmod命令_打开终端的命令Linux_查看用户的命令Linux

4. linuxc disk management

The file /etc/fstab records the hard disk partition situation in Ubuntu in detail,

查看用户的命令Linux_linux的chmod命令_打开终端的命令Linux

There is a line "/wason/dev/sda1duringinstallation", which means that the root directory "/" is on /dev/sda1 Linux chmod command , where "/" is the mount point, " /dev/sda1" is the hard drive where we install the Ubuntu system. Because our system is installed in a virtual machine. You can view the c drive in the current system through the following command:

ls/dev/sd*The above command is to copy all the device files starting with /dev/sd,

There are four c drive device files in

, where sd indicates a SATA hard drive or other external device, and the last

The number in

represents the nth partition on the hard disk. For example, /dev/sda1 represents the first partition on drive c. sda. picture

all start with /dev/sda, indicating that there is currently only one hard drive. If you plug in a U disk, SD card, etc., /dev/sdb, /dev/sdc, etc. may appear. If your USB flash drive has two partitions, device files such as /dev/sdb1 and dev/sdb2 may also appear.

打开终端的命令Linux_查看用户的命令Linux_linux的chmod命令

c drive management command

1. Disk partition command fdisk

If you want to partition a certain c drive, you can use the command fdisk. The command format is as follows:

fdisk

[parameter]

The main parameters are as follows:

-b

Specify the size of each partition.

-l

List the partition table of the specified device.

-s

Output the specified partition size to standard output, in blocks.

-u combined with the "-l" parameter will use the number of partitions instead of the number of cylinders to represent the starting address of each partition.

For example, if I want to partition the U disk, I must not partition the Ubuntu system I installed! ! ! You can use the following command

Command: sudofdisk/dev/sdb

linux的chmod命令_打开终端的命令Linux_查看用户的命令Linux

The above is the detailed content of The principle and usage of ll command to view directory information list in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Mastering Text Manipulation With the Sed CommandMastering Text Manipulation With the Sed CommandMar 16, 2025 am 09:48 AM

The Linux command line interface provides a wealth of text processing tools, one of the most powerful tools is the sed command. sed is the abbreviation of Stream EDitor, a multi-functional tool that allows complex processing of text files and streams. What is Sed? sed is a non-interactive text editor that operates on pipeline inputs or text files. By providing directives, you can let it modify and process text in a file or stream. The most common use cases of sed include selecting text, replacing text, modifying original files, adding lines to text, or removing lines from text. It can be used from the command line in Bash and other command line shells. Sed command syntax sed

Pilet: A Modular, Portable Mini-Computer Powered by Raspberry PiPilet: A Modular, Portable Mini-Computer Powered by Raspberry PiMar 06, 2025 am 10:11 AM

Discover Pilet: A Retro-Futuristic, Open-Source Mini-Computer Looking for a mini-computer that blends classic style with cutting-edge technology? Meet Pilet, a modular, open-source marvel powered by the Raspberry Pi 5. Boasting a 7-hour battery life

Linux Kernel Source Code Surpasses 40 Million LinesLinux Kernel Source Code Surpasses 40 Million LinesMar 05, 2025 am 09:35 AM

Linux: The cornerstone of modern computing, from smartphones to supercomputers, can do everything. Over the years, the size and complexity of the Linux kernel has increased significantly. As of January 2025, the Linux kernel source code contains approximately 40 million lines of code! This is one of the greatest achievements in the history of open source, community-driven projects. This article will discuss the exponential growth of the number of lines in the Linux kernel source code, the reasons and how to check the current number of lines by yourself. Directory -Linux kernel history Count the number of lines of the Linux kernel source code only count C and header files Exponential trend of kernel growth Verify historical Linux kernel lines Summary Linux kernel history Since 1991 Linus Tor

How To Count Files And Directories In Linux: A Beginner's GuideHow To Count Files And Directories In Linux: A Beginner's GuideMar 19, 2025 am 10:48 AM

Efficiently Counting Files and Folders in Linux: A Comprehensive Guide Knowing how to quickly count files and directories in Linux is crucial for system administrators and anyone managing large datasets. This guide demonstrates using simple command-l

The Secret Weapon to Supercharge Your Linux System With Liquorix KernelThe Secret Weapon to Supercharge Your Linux System With Liquorix KernelMar 08, 2025 pm 12:12 PM

Liquorix kernel: a powerful tool to improve Linux system performance Linux is known for its flexibility, security and high performance, becoming the operating system of choice for developers, system administrators, and advanced users. However, the universal Linux kernel is not always meeting the needs of users seeking maximum performance and responsiveness. This is where the Liquorix kernel comes into play—a performance-optimized alternative that promises to enhance your Linux system. This article will explore what the Liquorix kernel is, why you might want to use it, and how to install and configure it to get the most out of your system. Liquorix kernel detailed explanation Liquorix kernel is a precompiled Linux kernel designed for

How To Add A User To Multiple Groups In LinuxHow To Add A User To Multiple Groups In LinuxMar 18, 2025 am 11:44 AM

Efficiently managing user accounts and group memberships is crucial for Linux/Unix system administration. This ensures proper resource and data access control. This tutorial details how to add a user to multiple groups in Linux and Unix systems. We

System76 Introduces Meerkat Mini PC: Big Power in a Tiny PackageSystem76 Introduces Meerkat Mini PC: Big Power in a Tiny PackageMar 05, 2025 am 10:28 AM

The System76 Meerkat: A Mighty Mini PC Looking for a powerful yet space-saving computer? Meet the Meerkat mini PC from System76! This compact powerhouse is perfect for tidy desktops and demanding tasks. Table of Contents - Compact Design, Impressive

Building Your Own Ubuntu Personal Cloud: A Step-by-Step Guide to Creating a Secure Data HavenBuilding Your Own Ubuntu Personal Cloud: A Step-by-Step Guide to Creating a Secure Data HavenMar 05, 2025 am 11:02 AM

In today's digital age, data is not just information, but also a part of our lives. From photos and documents to sensitive personal information, our data represents our memories, work and interests. Although cloud storage services are widely available, they are often accompanied by privacy concerns, subscription fees, and customization restrictions. That's what building a personal cloud on Ubuntu is about as a powerful alternative, which gives you complete control over your data and the flexibility to customize and scale as needed. This guide will guide you to set up a Ubuntu-based personal cloud, use Nextcloud as the primary application, and ensure your settings are secure and reliable. Why build a personal cloud on Ubuntu? Ubuntu is the most popular Linux

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Atom editor mac version download

Atom editor mac version download

The most popular open source editor