Some cloud computing to share learning course syllabus information, this article is some information about the process of viewing the process, I hope to give you some help:
Such as understanding the process:
• PID,PPID
• The current process status
• memory allocation
• CPU and the actual time is spent
• User UID, he decided to privileged processes
netstat -anptu view port
[Root @ tianyun ~] # yum clean all // remove the original old YUM database information
[root@tianyun ~]# yum makecache
Static view the process ps
[Root @ Tianyun ~] # ps aux | less
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 2164 648 ? Ss 08:47 0:00 init [5]
USER: User running processes
PID: Process ID
% CPU: CPU usage
% MEM: memory usage
VSZ: the virtual memory
RSS: The actual memory resident memory footprint
TTY: terminal processes running
STAT: process state man ps (/ STATE)
R Run
S Interruptible sleep Sleep
D uninterruptible sleep (usually IO)
T stopped process
Z zombie process
X dead process
START: process start-up time
TIME: total CPU time the process takes
COMMAND: process file, process name
[root@tianyun ~]# ps aux --sort %cpu |less
[root@tianyun ~]# ps aux --sort -%cpu |less
[Root @ Tianyun ~] # ps aux --sort rss | less
[Root @ Tianyun ~] # ps aux --sort -rss | less
[root@tianyun ~]# yum -y install httpd
[root@tianyun ~]# systemctl start httpd
[root@tianyun ~]# ps auxf |grep [h]ttpd
root 8310 0.0 0.1 10092 2912 ? Ss 14:19 0:00 /usr/sbin/httpd
apache 8311 0.0 0.0 10092 2060 ? S 14:19 0:00 \_ /usr/sbin/httpd
apache 8312 0.0 0.0 10092 2060 ? S 14:19 0:00 \_ /usr/sbin/httpd
apache 8313 0.0 0.0 10092 2060 ? S 14:19 0:00 \_ /usr/sbin/httpd
apache 8314 0.0 0.0 10092 2060 ? S 14:19 0:00 \_ /usr/sbin/httpd
apache 8315 0.0 0.0 10092 2060 ? S 14:19 0:00 \_ /usr/sbin/httpd
apache 8316 0.0 0.0 10092 2060 ? S 14:19 0:00 \_ /usr/sbin/httpd
apache 8318 0.0 0.0 10092 2060 ? S 14:19 0:00 \_ /usr/sbin/httpd
apache 8319 0.0 0.0 10092 2060 ? S 14:19 0:00 \_ /usr/sbin/httpd
[root@tianyun ~]# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 08:47 ? 00:00:00 init [5]
// custom display fields
[root@tianyun ~]# ps axo user,pid,ppid,%mem,command
[root@tianyun ~]# ps axo user,pid,ppid,%mem,command |grep httpd
root 8310 1 0.1 /usr/sbin/httpd
apache 8311 8310 0.0 /usr/sbin/httpd
apache 8312 8310 0.0 /usr/sbin/httpd
apache 8313 8310 0.0 /usr/sbin/httpd
apache 8314 8310 0.0 /usr/sbin/httpd
apache 8315 8310 0.0 /usr/sbin/httpd
apache 8316 8310 0.0 /usr/sbin/httpd
apache 8318 8310 0.0 /usr/sbin/httpd
apache 8319 8310 0.0 /usr/sbin/httpd
root 9236 6798 0.0 grep httpd
[root@tianyun ~]# ps axo user,pid,ppid,%mem,%cpu,command --sort -%cpu |less
// Check the specified process PID
[A @ iZm5eiwihahzq6ds23gbf6Z ~] $ cat /run/sshd.pid
830
[Root @ Tianyun ~] # ps aux | grep sshd
root 10180 0.0 0.0 7224 1024 ? Ss 16:00 0:00 /usr/sbin/sshd
[root@tianyun ~]# pgrep -l sshd
10180 sshd
[root@tianyun ~]# pgrep sshd
10180
[root@tianyun ~]# pidof sshd
10180
// Process Tree View
[root@tianyun ~]# pstree
Dynamic process top view
[root@tianyun ~]# top
[root@tianyun ~]# top -d 1
Dynamic information [root @ tianyun ~] # top -d to view the specified process 1 -p 10126
[root@tianyun ~]# top -d 1 -p 10126,1
[Root @ tianyun ~] # top -d 1 -u apache view the specified user process
top -d 1 -u sshd
[Root @ tianyun ~] # top -d 1 -b -n 2> top.txt the secondary information is written to the file top
Overall Statistical Information System: Part I
top - 14:15:04 up 47 min, 2 users, load average: 0.25, 0.18, 0.12
Tasks: 235 total, 1 running, 234 sleeping, 0 stopped, 0 zombie
People (s): 8.9% us, 1.0% sy, 0.0% Ni, 90.1% id, when 0.0%, 0.0% hi, 0.0% si, 0.0% st
Mem: 7944064k total, 746164k used, 7197900k free, 35724k buffers
Swap: 1048568k total, 0k used, 1048568k free, 261492k cached
load average: 0.86, 0.56, 0.78 CPU last 1 minute, 5 minutes, 15 minutes average load
Part II: Process Information
command
h |? Help
Sort memory usage M
By using a sort CPU P
Sort PID of size N
Sorting reversing the R
Custom display field f
1 shows all the CPU load
<Forward
> Back
z Color
W save the top environment settings ~ / .toprc
netstat
netstat to view the current system network system status information, including port, connections, etc., in the usual manner as follows:
netstat -atunlp, the respective parameters are as follows:
-t: TCP port specified display
-u: UDP port specified display
-l: Displays only listening sockets (LISTEN state of the socket)
-p: display the process identifier and program name, and each socket / port belongs to a program
-n: no DNS resolution
-a displays all connected ports • 1
一般该指令会与grep配合使用,比如查找端口22,就用netstat -tunlp | grep 22 或者干脆netstat -an | grep 22就可以了,查看其它端口类似,当然也可以通过端口状态查找即netstat -anp | grep TIME_WAIT,即只会显示含有TIME_WAIT字符串的条目
lsof
lsof的作用是列出当前系统打开文件(list open files),不过通过-i参数也能查看端口的连接情况,-i后跟冒号端口可以查看指定端口信息,直接-i是系统当前所有打开的端口
lsof -i:22 #查看22端口连接情况,默认为sshd端口
北京 ------------------------------------------------->> 广州
server1 192.168.1.2 10.10.10.2
server2 192.168.1.3 10.10.10.3
1 切服务
2系统级: 修改DNS 网卡配置文件 路由
root
cisco -switch-01口
cisco -switch-02口
变更
IP地址
10.10.10.2 --------------------------→ 192.168.2.3
ping 192.168.2.3 -->不通才可继续操作
ssh 10.10.10.2
修改网卡配置文件/ip地址 /-----192.168.2.3/----->路由---关
systemctl restart network--->xshell XXX掉线----→ 交换机端口的vlan id--->