Linux Learning notes-viewing and management of processes, SYSTEMCTL commands

Source: Internet
Author: User
Tags time 0 pkill

####################################################
###################### #第七单元 ######################
####################################################
1. What is a process, thread
A process is a self-contained program that is a motion activity of a data set, a process that is what the system is doing
A thread is a process that is the base unit for allocating resources.

2. Process status
Run
Dormancy
Stop it
Go on
End
The zombie process (which has ended the process but still occupies the list of processes, if too many will cause the system to crash.) The parent process is generally required to "corpse")

3. How to view processes in a drawing
Gnome-system-monitor

4. How to view processes with commands
PS # #进程查看工具
-A # #列出所有进程
-X # #与shell无关运行的进程 (Shell-independent process)
-U # #查看进程用户
-L # #显示进程的详细信息
-F # #完全信息full的缩写 (dependency)
-O # #控制输出, specifying information
-E # #显示系统中的所有进程和a相同 (additional outreach information)
-aux # #显示所有包含其他使用者的行程
Ps-aux | grep # #进程关键字 (filter)
Ps-aux | Less # #ps命令结果较长, can be combined with less command
PS aux--sort + or-%cpu or%mem ... # #进程按指定方式排序,--sort sort, + descending,-ascending
PS Ax-o%cpu # #指定只看%cpu information (or%MEM or UID or PID or comm or group or stat)

Pstree Command # #树型结构显示

Interpretation of relevant data meanings:
F represents this program's flag flag,4 Standard user is super user
s represents the status of this program stat
UID: The program is owned by this UID.
PID: ID of this program
PPID: ID of the parent process
The percentage of resources used by the C:CPU.
pri or (PR): Kernel scheduling priority, the smaller the priority the higher the abbreviation of priority (precedence order).
A Ni:nice value that represents a low priority.
ADDR: Indicate which part of the program is in-memory,-represents running
SZ: The amount of memory used.
Wchan: The current state of operation,-for operation.
Time that the CPU is consumed.
CMD: The command being issued.
%CPU: The percentage of CPU resources that are used off.
%MEM: The percentage of physical memory that is accounted for.
VSZ: The amount of virtual memory that is used.
RSS: The amount of fixed memory that is occupied.
TTY: The terminal location of the logged-in person
? Indicates that it is not related to the terminal, TTY1-TTY6 is the login program on this computer, pts/0 represents a program that is connected to the host by the network.
STAT: The current state, as follows
R: The program is currently in operation.
S: The program is currently in sleep (idle state) and can be awakened by certain signals (signal).
T: The program is currently being monitored or stopped.
Z: The process should have been terminated, but the parent process could not terminate it and become a zombie process.

Eg:ps ax--sort%cpu, comm|head-10|grep-v pid #-V does not display PID
PS Ax--sort%cpu, pid|head-5 (PID)

Difference top command: PS command can give a snapshot of the process in the current system, the top command can constantly update the status of the viewing process, PS combined with watch command can also be observed dynamically.

5. How to control the front and back calls of processes in the shell

Command followed by & # #进程在shell后台运行
CTRL +z # #把占用shell的进程打入后台停止
Jobs # #查看被打入后台的进程信息
FG Job Number # #把指定进程调回前台
BG Job number # #运行后台停止进程
CTRL +c # #关闭占用shell进程

6. How to control processes with commands
Kill # #用来终止后台进程
-S: Specify Send signal
-P: Analog Send Signal
-L: Specify a Name list for the signal

1) signal (general kill can be used directly with the signal)
Signal 1 # #挂起进程
Signal 2 # #删除进程在内存中的信息, interrupt process (with CTRL +c)
Signal 3 # #内存中的鼠标信息清除ctrl \
Signal 9 # #强行关闭进程 (Use caution)
Signal # #正常关闭进程
Signal # # #开启停止的进程, continue the process
Signal # #停止正在运行的进程, pause process
Signal # #ctrl +z


2) Signal Initiation
Kill Signal PID
Killall signal Process Name # #直接杀死运行中的程序
Pkill-u Username # #结束某个用户的所有进程 (same as killall usage)
Pkill Process Name # #指定进程名称进行结束

7. User Login Monitoring
W Command # #查看当前使用系统的用户 (WHO)
W-f # #查看当前使用系统的用户并显示使用地点
Note: Header information includes current time, system run time, number of users, average load (last 1, 5, 15 minutes),
User: Represents users
TTY: The terminal location of the logged-in person
Login: Current User login time
Idel: User logon System Idle time
JCPU: The CPU time consumed by the user when all programs are executed by the terminal
What: What the current user is doing

Last # #查看登陆过系统的用户
LASTB # #查看试图登陆但没有成功的用户

8.top command
U username # #现实此用户的所有进程
K Signal # #kill
H # #help
S # #调整top命令刷新频率
M # #内存排序
C # #cpu排序
Q # #退出界面
Note: header information includes:
2 Running: Run the process book, at this time 2
0 Sleeping: Number of dormant processes, at this time 0
0 stopped: Number of processes stopped, 0 at this time
0 Zombie: Number of zombie processes, 0 at this time
%CPU (s)
0.3%us: Percentage of CPU occupied by user space
1.0% sy: CPU Percentage of kernel space
0.0% ni: Percentage of CPU per process that has changed priority in user space
98.7% ID: Percentage of idle CPU
0.0% wa: Percentage of waiting input and output time
MEM:191272K Total physical memory, used: physical memory already in use, free: unused
Buffers: The amount of memory used as the kernel cache



###################################################
################### #第八单元 #######################

1. What is a service?
Service
Service is the software running in the system, this software is mainly to provide a function, this kind of software is called service

2. Service Management SYSTEMCTL command (to replace Systemv\service\chkconfig command)
Systemctl is a systemd tool that is primarily responsible for controlling SYSTEMD systems and service management.
Systemctl Start Service Name sshd # # #开启服务
Stop .... # # #关闭服务
Restart .... # # #重启服务
Reload .... # # #重新加在服务配置
Status .... # # #查看 Service Status
Enable .... # # #设定服务开机启动
Disable .... # # #禁止服务开机启动
List-dependencies (Note using tab) # # #查看服务依赖关系
List-units # # #查看当前运行的所有服务
List-unit-files # # #查看服务的开机启动情况
Set-default Multi-user.target # # #开机不启动图形 StartX can then turn on the graphics
Set-default Graphical.target # # #开机启动图形

This article is from the "12148275" blog, please be sure to keep this source http://12158275.blog.51cto.com/12148275/1897335

Linux Learning notes-viewing and management of processes, SYSTEMCTL commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.