Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The Foundation of linux Command (2)

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Linux directory

Common catalogs and their explanations

/ bin:

Bin is an acronym for Binary, and this directory holds the most frequently used commands.

/ boot:

Here are some of the core files used to start Linux, including some connection files and image files.

/ dev:

Dev is the abbreviation of Device (device). In this directory, the external devices of Linux are stored. The way of accessing devices in Linux is the same as the way of accessing files.

/ etc:

This directory is used to store all the configuration files and subdirectories needed for system management.

/ home:

The user's home directory. In Linux, each user has his own directory, which is usually named after the user's account.

/ lib:

This directory stores the system's most basic dynamic link sharing library, which works similar to the DLL file in Windows. Almost all applications need to use these shared libraries.

/ media:

The linux system will automatically identify some devices, such as USB drives, optical drives, and so on. When identified, linux will mount the identified devices to this directory.

/ opt:

This is the directory where additional software is installed for the host. For example, if you install an ORACLE database, you can put it in this directory. The default is empty.

/ proc:

This directory is a virtual directory, it is a mapping of system memory, we can access this directory directly to get system information.

The contents of this directory are not on the hard disk but in memory. We can also modify some files directly. For example, you can use the following command to block the ping command of the host, so that others cannot ping your machine:

/ root:

This directory is the system administrator, also known as the super-privileged user home directory.

/ sbin:

S means Super User, and here is the system management program used by the system administrator.

/ srv:

This directory stores some data that needs to be extracted after the service is started.

/ usr:

This is a very important directory where many of your applications and files are placed, similar to the program files directory under windows.

/ usr/bin:

The application used by the system user.

/ usr/sbin:

More advanced hypervisors and system daemons used by superusers.

/ usr/src:

The default placement directory for kernel source code.

/ var:

This directory contains things that are constantly expanding, and we are used to putting directories that are often modified in this directory. Including various log files.

Directory structure: tree structure (as shown in the following figure)

Command

1. Cat: view the contents of the file

2.more: viewing file contents

Cat also looks at the contents of the file, but sometimes the content of the file is too much for a screen to display, and the content displayed by cat cannot be flipped over.

At this point, the more command can solve this problem.

At this point, you can use the Enter key to turn the page down line by line

Use the spacebar to flip down the screen

Turn the page up with the B key

Use the Q key to exit reading mode

3.less:

More view will automatically exit the viewing mode from the page turn to the last page. If you want to go back to view, you need to re-enter. Less is the advanced version of more, which can effectively solve this problem.

Interactive operation method:

Page Up page up, Page Down page down

Press the "/" key to find the content, "n" next content, "N" last content

Other functions are basically similar to more commands.

4.head: view part of the beginning of the file (default is 10 lines)

Tail: view the last part of the file (default is 10 lines)

5.wc: statistics file content

Common option

-l: count the number of rows

-w: count the number of words

-c: statistics of total bytes

6 GREP: retrieve and filter the contents of files

Common command options

-I: ignore case when looking up

-v: reverse lookup and output lines that are different from the lookup criteria

Find condition settin

"^." Denote with. At the beginning, ". $" means with. End

"^ $" represents a blank line

When too many files are displayed, you can use the redirect symbol > to generate the content into a text document and view it. When the content generated by the second view needs to be followed by the previous content, you need to use > > to generate it.

7.gzipdirection bzip2: zip the file

-9 compressed files (you don't have to write)

-d extract the file

8.tar: archive command

Gzip and bzip2 delete the source file when using the function. If we don't need to delete the source file, we need the tar command.

Common command options

-c: create a compressed package

-x: decompression

-v: display details

-f: execute (required option)

-p: retain the original permissions

-t: view the contents of the package

-C: decompress the target path

-z: end of path in gzip format (.tar.gz)

-j: bzip format

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report