linux系统管理命令

系统管理命令:

ps aux

操作系统:管理硬件软件资源的应用程序。

进程:有资格从操作系统申请资源。

守护进程:在后台运行的进程,没有终端控制的进程。

[zyj@localhost home]$ tail -f 1.txt
dfdfsdfsf

[zyj@localhost ~]$ ps aux | grep tail
zyj        3157  0.0  0.0 100964   608 pts/2    S+   09:54   0:00 tail -f 1.txt
zyj        3161  0.0  0.0 103304   744 pts/1    S+   09:54   0:00 grep tail

非守候进程:服务在后台运行的进程。

ps命令查看系统进程的详细状况;

-a :显示终端上所有进程,包括其他用户的进程

-u:显示进程的详细状态

-x:显示没有控制终端的进程

-w:显示加宽,以便显示更多信息

-r:只显示正在运行的进程

[zyj@localhost home]$ ps au
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root       2483  0.0  0.0   4068   544 tty2     Ss+  09:43   0:00 /sbin/mingetty /dev/tty2
root       2485  0.0  0.0   4068   540 tty3     Ss+  09:43   0:00 /sbin/mingetty /dev/tty3
root       2487  0.0  0.0   4068   540 tty4     Ss+  09:43   0:00 /sbin/mingetty /dev/tty4
root       2489  0.0  0.0   4068   544 tty5     Ss+  09:43   0:00 /sbin/mingetty /dev/tty5
root       2491  0.0  0.0   4068   540 tty6     Ss+  09:43   0:00 /sbin/mingetty /dev/tty6
root       2513  0.5  2.8 176352 29116 tty1     Ss+  09:43   0:04 /usr/bin/Xorg :0 -br -verbose -audit 4 -auth /var/run/gdm/auth-fo
zyj        2928  0.0  0.1 108336  1684 pts/0    Ss+  09:45   0:00 /bin/bash
zyj        2949  0.0  0.1 108364  1812 pts/1    Ss+  09:45   0:00 -bash
zyj        3130  0.0  0.1 108364  1840 pts/2    Ss   09:53   0:00 -bash
zyj        3219  0.0  0.1 110232  1068 pts/2    R+   09:57   0:00 ps au

top:监控操作系统的运行情况,非守护进程,由终端控制,按q退出。

[zyj@localhost ~]$ top
top - 09:59:34 up 16 min,  4 users,  load average: 0.27, 0.17, 0.11
Tasks: 153 total,   1 running, 152 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.3%us,  0.7%sy,  0.0%ni, 97.0%id,  2.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1004112k total,   907020k used,    97092k free,     8272k buffers
Swap:  2031612k total,        8k used,  2031604k free,   607472k cached

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                             
    24 root      20   0     0    0    0 S  0.3  0.0   0:00.27 ata_sff/0                                                            
  2948 zyj       20   0 99.7m 1856  860 S  0.3  0.2   0:00.09 sshd                                                                 
  3259 zyj       20   0 15036 1280  948 R  0.3  0.1   0:00.14 top                                                                  
     1 root      20   0 19352 1416 1096 S  0.0  0.1   0:01.98 init                                                                 
     2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kthreadd                                                             
     3 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0                                                          
     4 root      20   0     0    0    0 S  0.0  0.0   0:00.04 ksoftirqd/0                                                          
     5 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 stopper/0                                                            
     6 root      RT   0     0    0    0 S  0.0  0.0   0:00.01 watchdog/0       

kill:杀死一个进程。

[zyj@localhost home]$ tail -f 1.txt 
dfdfsdfsf


[zyj@localhost home]$ ps aux | grep tail
zyj        3316  0.0  0.0 100964   608 pts/1    S+   10:01   0:00 tail -f 1.txt
zyj        3324  0.0  0.0 103304   744 pts/2    S+   10:02   0:00 grep tail 
[zyj@localhost home]$ kill -9 3316

[zyj@localhost home]$ tail -f 1.txt 
dfdfsdfsf
Killed
[zyj@localhost home]$ 
[zyj@localhost home]$ tail -f 1.txt 
dfdfsdfsf

[zyj@localhost home]$ ps aux | grep tail
zyj        3361  0.0  0.0 100964   608 pts/1    S+   10:04   0:00 tail -f 1.txt
zyj        3363  0.0  0.0 103304   748 pts/2    S+   10:04   0:00 grep tail
[zyj@localhost home]$ killall tail
[zyj@localhost home]$ ps aux | grep tail
zyj        3372  0.0  0.0 103304   748 pts/2    S+   10:04   0:00 grep tail

猜你喜欢

转载自www.cnblogs.com/zhaoyujiao/p/8954836.html