Linux系统相关命令

1. 查询时间:date命令

[root@Server-n93yom ~]# date
Thu Jul 25 23:47:24 CST 2019

2.查询日历:cal命令     cal -y 显示一年的日历

[root@Server-n93yom ~]# cal
      July 2019
Su Mo Tu We Th Fr Sa
    1  2  3  4  5  6
 7  8  9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31

 

3.查询磁盘剩余空间:df -h   (df为disk free)    

[root@Server-n93yom ~]# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/cl-root   47G   19G   29G  40% /         //家目录 总使用19G可用29G
devtmpfs             7.8G     0  7.8G   0% /dev
tmpfs                7.8G   16K  7.8G   1% /dev/shm
tmpfs                7.8G   17M  7.8G   1% /run
tmpfs                7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1           1014M  139M  876M  14% /boot
tmpfs                1.6G     0  1.6G   0% /run/user/0

4.查询文件目录的大小:du -h [目录名] (du为disk usage)

  -h 人性化的显示文件的大小

[root@Server-n93yom ~]# ll
total 8
-rw-------. 1 root root    1706 Jun 17 09:56 anaconda-ks.cfg
-rw-r--r--  1 root root       1 Jul 25 23:05 cal.txt
drwxr-xr-x  2 root guanbin   19 Jul 22 16:09 test
drwxr-xr-x. 2 root root      54 Jul 23 14:02 tmp
[root@Server-n93yom ~]# du -h tmp
34M    tmp
[root@Server-n93yom ~]#

 

5. ps aux    查看当前进程的详细状况  

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

   u:显示进程的详细状态

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

[root@Server-n93yom ~]# ps
  PID TTY          TIME CMD
  799 pts/0    00:00:00 bash
 1490 pts/0    00:00:00 top
 4947 pts/0    00:00:01 du
 5036 pts/0    00:00:00 ps
[root@Server-n93yom ~]#
[root@Server-n93yom ~]# ps a
  PID TTY      STAT   TIME COMMAND
  706 tty1     Ss+    0:00 /sbin/agetty --noclear tty1 linux
  799 pts/0    Ss     0:00 -bash
 1490 pts/0    T      0:00 top
 4947 pts/0    T      0:01 du -h
 5139 pts/0    R+     0:00 ps a
[root@Server-n93yom ~]#
[root@Server-n93yom ~]# ps au
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root       706  0.0  0.0 110036   840 tty1     Ss+  Jul19   0:00 /sbin/agetty --noclear tty1 linux
root       799  0.0  0.0 115484  2172 pts/0    Ss   22:41   0:00 -bash
root      1490  0.0  0.0 157720  2284 pts/0    T    22:53   0:00 top
root      4947  0.6  0.0 108552  1504 pts/0    T    23:50   0:01 du -h
root      5144  0.0  0.0 151060  1828 pts/0    R+   23:54   0:00 ps au

6. top         动态显示运行中的进程并且排序    q退出该命令

[root@Server-n93yom ~]# top
top - 23:55:38 up 6 days,  8:04,  1 user,  load average: 0.05, 0.09, 0.07
Tasks: 155 total,   2 running, 151 sleeping,   2 stopped,   0 zombie
%Cpu(s):  0.7 us,  0.3 sy,  0.0 ni, 98.8 id,  0.1 wa,  0.0 hi,  0.1 si,  0.0 st
KiB Mem : 16264548 total,  4064528 free,  8669832 used,  3530188 buff/cache
KiB Swap:  2097148 total,  2097148 free,        0 used.  7169176 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
  730 mysql     20   0 8505256 1.423g  17008 S   0.7  9.2  52:11.58 mysqld
 1200 consul    20   0  209392  51200  31248 S   0.7  0.3  26:40.10 consul
 2770 rabbitmq  20   0 3378860 111520   4652 S   0.7  0.7  69:23.84 beam.smp
 4147 cfyuser   20   0 4749292 0.986g  19516 S   0.7  6.4  42:45.91 java
17414 tomcat    20   0 12.240g 2.808g  13896 S   0.7 18.1  29:14.69 java
 1185 prometh+  20   0  166468  51148  18532 S   0.3  0.3  12:59.10 prometheus
 1188 cfyuser   20   0  852492  73116   7200 S   0.3  0.4  12:52.08 celery
 1229 cfyuser   20   0   16072   4884   3416 S   0.3  0.0   9:48.48 serf
 5193 root      20   0  157720   2284   1560 R   0.3  0.0   0:00.03 top
    1 root      20   0   43352   3716   2384 S   0.0  0.0   0:16.50 syste

7. kill [-9]  进程号 :  终止指定代号的进程,-9表示强行终止

 

posted @ 2019-07-25 23:48  纵码万水千山  阅读(266)  评论(0编辑  收藏  举报