[Reprint] Linux Tutorials (8) -Linux in the process and log 㐇,

Linux Tutorials (8) -Linux in the process and the log

Disclaimer: This article is a blogger original article, follow the  CC 4.0 BY-SA  copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_42350428/article/details/81879786

Process in Linux 
process: start strength has run executable program

1, PID: ID process (each new process has a unique PID) 
2, PPID: parent process ID 
3, any process can create a child process 
4, more than redhat 7, the parent of all processes : systemd 
in redhat 5,6, the parent of all processes: init

ps displays the current status of the process 
commonly used options 
-aux: list all processes 
-ef: list all processes 
-l: List the current users and related processes 
-u user: a user to view the process status

top can view real-time process status

Operation: 
R: The process is running or waiting to run 
sleep: 
S: is sleeping but can be woken 
D: is sleeping, and not wake up, the process is interrupted, may cause an abnormal state of the device 
K: is sleeping and it can not be awakened, the process can be interrupted. 
Stopped: 
T: the process is stopped, but can be recovered by other processes 
T: being debugged process 
zombie: 
the Z-: child process send a signal to the parent process when you exit, in addition to PID, all resources released 
X: Get the parent structure of the sub-process, sub-process can be completely released, the state of the process is not visible to 
the process priority 
1, <high priority 
2, n low priority? 3, s subprocess comprising? 4 + in the background process group

ps -aux of parameters 
1,% CPU: CPU utilization occupancy 2,% MEM:? occupied by the memory usage of 3, VSZ:? occupied by the virtual memory size 4, RSS:? occupied memory size 5? , TTY: secondary device number (minor device number of tty) 6 , STAT terminal:? stroke state of the 
instruction being executed: 7, sTART: start time of travel 8, tIME:? execution time 9, cOMMAND?

Write pictures described here 
Write pictures described here

Linux interrupt process 
signals: the process is passed to the Linux operating

kill -l displays all signals can be passed to the Linux process

常用: 
kill -9 PID 杀死一个进程—强制 
kill -15 PID 正常的方式终止一个进程 
kill -2 可以control+c的操作是一样的 
Write pictures described here

Write pictures described here
Write pictures described here 
start:在系统中启动一项服务 
stop:等待程序需处理完毕后再stop, 
restart:直接关闭程序 在开启 
reload:重新加载配置文件,进程暂停,然后把配置文件加载进去后,继续执行后续操作。进程的PID不会发生改变 
enable:设置开机自启 
disable:关闭开机自启 
status:查看某一单元的状态

Linux in the log 
analysis and storage of logs 
logs: a system for auditing and troubleshooting -Liunx the "black box" 
log files are stored in / var / log directory 
in RedHat 7, the system log messages the responsibility of the two services deal with. They are systemd-journald and rsyslogd. 
/ var / log / messages // log majority system log messages of 
/ var / log / secure // security and authentication of messages and error log 
/ var / log / maillog // associated with the mail server's log 
/ var / log / cron // log files associated with recurring tasks 
/ var / log / boot / log // record a log related to system startup and 
Write pictures described here
most log consists of four parts 
1, at the time of recording the log 
2 transmits the log the host 
3 transmits the log messages or process 
4, the actual message sent

Log Monitoring 
tail -f / var / log / secure // display the last 10 lines, if there is new content is added, it will continue to output

Guess you like

Origin www.cnblogs.com/jinanxiaolaohu/p/11855007.html