Lesson (novice master liunx command :)

一、Shell

Principle : Shell (also referred to as terminal or shell) acts as a translator between the people and the core (hardware), users put some command "tell" the terminal, it will call the appropriate program service to complete some of the work. Now includingRed Hatterminal many mainstream Linux system, including the system default is Bash (Bourne-Again SHell) interpreter.

A. In liunx command format is : command name command parameters command object  Please separated by spaces between the keys.

                            Such as: LS (command) -l (parameter) / root (command object) as shown:

B. common command system works :

 1.echo command: used to output the value of the terminal extraction string or variable, and the values extracted by the variable $ SHELL variable manner, and outputs it to the screen, as shown:

2.date command : used to display the date and time or set the system parameters to input "+" at the beginning of the number.

Parameters:% t (tabulator Tab key),% H (h 00 ~ 23),% I (hr 00 ~ 12),% M (minutes 00 ~ 59),% S (s 00 ~ 59),% j ( the first few days of the year),% Y (years),% m (month),% d (date)

Example: The current system time is set to November 11, 2019 in accordance with 08 points and 30 points "- in - date hour: minute: second" format check the current time: as shown:

3.reboot: reboot the system command

4.poweroff: shut down the system command These commands can only use the default root administrator to restart

5.wget command: download network file in the terminal. Format is "wget [parameters] Download"

Parameters: -b  (background download mode), -p   (downloaded to the specified directory), -t   (maximum number of attempts), - c (HTTP), -p  (within the download page for all resources, including images, videos, etc. ) , -r  (recursive download)

 

Example:

6.ps command : View the status of system processes, in the format "ps [parameters]."

Arguments: -a Show all processes (including those of other users), -u (users, and other details), -x (without display control process in a terminal)

He has five common process status: a, R (running): process is running or waiting in the run queue. (The process is to provide users with services)

                                           Two, S (Sleeping) (Interrupt): the process is sleeping when the conditions for forming a signal is received or, if out of this state.

                                           Three, D (uninterruptible): Process system does not respond to asynchronous signals, even with the kill command nor can it be interrupted.

                                           Four, the Z- (Zombie) (dead): the process has been terminated, but the process descriptor remain until the parent calls wait4 () system function after the release process.

                                           Five, T (stopped) (Stop): Process after receiving a stop signal to stop running.

Example: ps command parameter not allow a minus sign (-)

 

 

7.top command: for information to dynamically monitor process activity and system load.

as the picture shows:

 

 

8.pidof command: query PID value of a specified service processes, different processes can be distinguished by the PID, the format is "pidof [parameters] [service name]."

as the picture shows:

 

9.kill command: terminate a specified PID service process in the format of "kill [parameters] [process PID]."

As shown in Figure: Stopping sshd service of process

10.killall command: used to terminate all processes specify the name of a service corresponding to the format: "killall [parameters] [service name]."

As shown: service httpd stop all processes

 

 

 

System state detection command C.

1.ifconfig command: for acquiring the network card configuration and status information, the format of "ifconfig [Network Device] [parameter]."

as the picture shows:

 

 

2.uname command: View system kernel and system version and other information, in the format of "uname [-a]". And view details of the current system version.

as the picture shows:

 

 

3.uptime command: to check the load of information systems, the system displays the current time, the system has been running time, the number of terminals to enable information and the average load value and so on. The average load value refers to the last 1 minute, 5 minutes, 15 minutes pressure situation within the system; load value as low as possible (from right to left to see), so as not more than one long-term, in a production environment should not exceed 5.

as the picture shows:

 

 

4.free command: display current system memory usage information, the format of "free [-h]".

as the picture shows:

 

 

5.who命令:查看当前登入主机的用户终端信息,格式为“who [参数]”。

如图所示:

 

6.last命令:查看所有系统的登录记录,格式为“last [参数]”。

如图所示:

 

7.history命令:用于显示历史执行过的命令,格式为“history [-c]”。历史命令会被保存到用户家目录中的.bash_history文件中。Linux系统中以点(.)开头的文件均代表隐藏文件,这些文件大多数为系统服务文件,可以用cat命令查看其文件内容。

如图所示:    加上“-c参数”是清除所有命令历史记录

 

8.sosreport命令:收集系统配置及架构信息并输出诊断文档,当Linux系统出现故障需要联系技术支持人员时,大多数时候都要先使用这个命令来简单收集系统的运行状态和服务配置信息。

如图所示:在下面的输出信息中,黄颜色的部分是收集好的资料压缩文件以及校验码,将其发送给技术支持人员即可:

 

 

Guess you like

Origin www.cnblogs.com/sheng-0/p/11839049.html