


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:
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:
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
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
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
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,
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.
-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:
Earlier we used numbers to change permissions. Let’s use letters to change permissions.
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.
-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
4. linuxc disk management
The file /etc/fstab records the hard disk partition situation in Ubuntu in detail,
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 inrepresents 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.
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
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!

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

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: 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

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

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

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

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

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


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

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
The most popular open source editor
