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

Linux basic operation command

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

1 linux system structure linux system generally consists of these parts: kernel Kernel, shell Shell, file system and application. The hierarchical structure is shown below:

Where:

Linux kernel mainly interacts with computer hardware and provides an advanced execution environment for user programs, which is divided into process scheduling, memory management, file management, inter-process communication and network interface according to functional modules.

two。 The interface Shell between the user and the operating system kernel has the following functions:

-read the input and parsing command line

-Redirection and plumbing

-search and run programs

-background job

-shell programming

3. Common shell programs

-Bourne Shell (SH) is the oldest and most widely used

-Korn Shell (KSH) extends SH and is compatible with SH

-C Shell (CSH) syntax is similar to C and is not compatible with SH

-the default Shell in Bourne Again Shell (BASH) Linux, which is compatible with SH and inherits the advantages of KSH\ C Shell.

4. Common peripheral tools (desktop systems)

-GNOME/GTK

Support for C language

Has the support of many companies or free software people, including RedHat

-KDE/QT (K Desktop Envirment)

Support Clearing, stable and mature

Including office software KOffice, Internet application software, development tool KDevelop, and some other application software

File system

-commands commonly used in bin:linux. Such as: cp, mv. -boot: the program to be used when the system starts. -dev: external device mapping file used in all linux systems. It is different from our commonly used windows and dos operating systems. It is actually a port to access these external devices. (virtual optical drive, usb)-etc: various configuration files and subdirectories managed by the system. Such as network profile, file system, x system profile, device information, setting user information (passwd, group)-home: the home directory of each user is stored in a subdirectory named after the user name under this directory. For example, if we create a user with a user name of "tom", then there is a corresponding / home/tom path under the / home directory-lib: store the system dynamic connection shared library-lost+found: this directory is empty in most cases. But if you are at work when there is a sudden power outage, or if your phone is not turned off in a normal way, when you restart the machine, some files will not be found where they should be stored. For these files, the system puts them in this directory. It's like providing a temporary shelter for the homeless. -mnt: the mount point of the partition, which is also empty under normal circumstances. You can temporarily hang other file systems in this directory. (cdrom, hgfs, usb)-proc: virtual directory, mapping of system memory, where you can get system information. This information is generated by the system itself in memory. -root: the home directory of the system administrator, which cannot be accessed by other users. -sbin: this directory is used to store system administrators' system management programs. -tmp: used to store temporary files generated during the execution of different programs. -usr: this is the directory that takes up the most hard disk space in the linux system. Many of the user's applications and libraries are stored in this directory, with many subdirectories. -Var: stores some temporary files during the operation of the system, such as system logs.

Note: distinguish different file types by color in each directory

Blue: catalog

Green: executable file

Red: compressed file

Light blue: linked fil

Gray: other files

Red background and white words: wrong link file

2 commonly used commands

2.1 get command help

Whatis

-- help

Man

2.2 File manipulation commands

Ls displays files or directories

-l list file details l (list)

-a lists all files and directories in the current directory, including hidden a (all)

-h list the file size in human words, press K\ M\ G

Mkdir create directory

-p create a directory, if there is no parent directory, create p (parent)

Cd changes directories

Touch creates an empty file

Echo creates a file with content.

Cat views the contents of the file

Cp copy

Mv move or rename (equivalent to renaming in the current directory)

Rename renaming

Rm deletes a file

-r Recursive deletion, subdirectories and files can be deleted

-f forcibly delete

Find searches the file system for a file

Wc counts the number of lines, words and characters in the text (if waiting for user input, ctrl+d ends input)

Grep looks for a string in a text file

Rmdir delete empty directory

Tree tree structure display directory, need to install tree package

Pwd displays the current directory

Ln creates a linked file

More and less display text file content in paging

Head and tail display the header and tail of the file.

Ctrl+alt+F1 command line full screen mode

Elaborate on the rename and find commands (wildcards * and? are often used. ). Rename is replaced by a string that matches the string to be replaced, such as: rename foo1 foo01 foo? Rename foo foo0 foo?? Find common expression:-print sends the current file name to the standard output device for display, and the return value is often true. -name pattern checks whether the file name is the same as pattern and uses quotation marks if necessary. -exec cmd is used to execute the cmd command. If the command uses the current file name, it should be marked with a semicolon to indicate the end of the cmd-type t checks if the current file type is t. T can be: d-directory, f-ordinary file, l-linked file. For example, find-name 'tty*' finds the linked file find. /-type l-exec {}\; finds the file find / etc/-name' * eth*'-exec ls-l {}\ where ip is stored.

2.3 Common system commands

Date display date

Stat displays the details of the specified file, which is more detailed than ls

Who displays online login users

Whoami displays the current operation user

Hostname displays hostname

Uname displays system information

Top dynamically displays the process information that consumes the most resources

Finger check how many terminals there are.

Ps displays instantaneous process status ps-aux

Du view directory size du-h / home displays directory information with units

Df View disk size df-h displays disk information with units

Ifconfig to check the network situation

Ping tests network connectivity

Netstat displays network status information

The man command will not be used, such as: man ls

Clear screen cleaning

Alias renames commands such as alias showmeit= "ps-aux" and removes the use of unaliax showmeit

Kill kills the process. You can first use the ps or top command to view the id of the process, and then use the kill command to kill the process.

Which to view the location of the program

2.4 commonly used shortcut keys

Ctrl+shift+ "+" magnification

Init 3 Command Line Interface init 5 graphical Interface (gedit etc/inittab)

Tab automatic completion

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