查看 系统版本
[supcon@izbp1hnrfc8sxyv5n43u6az /]$ cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
查看 系统信息
[supcon@izbp1hnrfc8sxyv5n43u6az /]$ uname -a
Linux izbp1hnrfc8sxyv5n43u6az 3.10.0-693.2.2.el7.x86_64 #1 SMP Tue Sep 12 22:26:13 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
查看 系统时间
[supcon@izbp1hnrfc8sxyv5n43u6az /]$ date
Tue Jul 24 22:51:44 CST 2018
---- 2. 用户相关信息 ----
查看 当前用户
[supcon@izbp1hnrfc8sxyv5n43u6az /]$ whoami
supcon
查看 目前登录系统用户
[supcon@izbp1hnrfc8sxyv5n43u6az /]$ w
22:52:17 up 40 days, 8:49, 1 user, load average: 8.64, 8.52, 8.66
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
supcon pts/0 115.204.91.173 22:12 1.00s 0.02s 0.05s sshd: supcon [priv]
---- 3. 硬件+性能相关 ----
查看 CPU信息
[supcon@izbp1hnrfc8sxyv5n43u6az /]$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 85
model name : Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz
stepping : 4
microcode : 0x1
查看 内存信息
[supcon@izbp1hnrfc8sxyv5n43u6az /]$ cat /proc/meminfo
MemTotal: 16267724 kB
MemFree: 443696 kB
MemAvailable: 2940876 kB
Buffers: 308948 kB
Cached: 2282180 kB
查看 cpu 内存 每五秒更新
[supcon@izbp1hnrfc8sxyv5n43u6az /]$ vmstat 5
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
9 0 0 442492 308948 2555672 0 0 0 5 3 1 16 0 84 0 0
10 0 0 442244 308948 2555704 0 0 0 1 4756 1232 100 0 0 0 0
20 0 0 441512 308948 2555708 0 0 0 9 5136 2711 100 0 0 0 0
查看 磁盘剩余空间
[supcon@izbp1hnrfc8sxyv5n43u6az /]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 2.4G 35G 7% /
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 832K 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/vdb1 453G 3.3G 427G 1% /mnt
tmpfs 1.6G 0 1.6G 0% /run/user/1000
查看 系统平均负载
[supcon@izbp1hnrfc8sxyv5n43u6az /]$ cat /proc/loadavg
9.55 10.16 9.32 8/1140 2597 (1、5、15分钟内的平均进程数、正在运行的进程数/进程总数、最近运行的进程ID号)
查看 系统运行时间+负载
[supcon@izbp1hnrfc8sxyv5n43u6az /]$ uptime
23:08:04 up 40 days, 9:05, 1 user, load average: 9.65, 9.98, 9.34
---- 4. 服务相关 ----
系统运行情况 - top
[supcon@izbp1hnrfc8sxyv5n43u6az /]$ top
top - 23:09:36 up 40 days, 9:06, 1 user, load average: 8.69, 9.60, 9.26
Tasks: 113 total, 1 running, 112 sleeping, 0 stopped, 0 zombie
%Cpu(s):100.0 us, 0.0 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 16267724 total, 444588 free, 12957800 used, 2865336 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 2942556 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3245 supcon 20 0 4737844 647128 14256 S 399.7 4.0 36329:56 java
14021 supcon 20 0 4728260 507192 14784 S 0.3 3.1 2:14.94 java
17081 supcon 20 0 4800080 787388 12044 S 0.3 4.8 25:23.55 java
30025 root 20 0 137872 16928 6276 S 0.3 0.1 64:13.55 AliYunDun
1 root 20 0 51732 2888 1484 S 0.0 0.0 6:43.01 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.12 kthreadd
---- 5. 日志相关 ----
查看 当前用户执行过的命令
[supcon@izbp1hnrfc8sxyv5n43u6az /]$ history
40 cd /
41 cd mnt
42 ls
43 ps -ef|grep fenghua-1.0.0.jar
44 kill -9 16855
45 ps -ef|grep fenghua-1.0.0.jar
46 rm fenghua-1.0.0.jar
47 ls
48 rm fenghua-1.0.0.out
---- 6. 文件相关 ----
显示文件总大小 每个文件大小
[supcon@izbp1hnrfc8sxyv5n43u6az /]$ ll -ht
total 84K
drwxrwxrwt. 44 root root 12K Jul 24 16:32 tmp
drwxr-xr-x 17 supcon root 4.0K Jul 24 16:32 mnt
dr-xr-x---. 7 root root 4.0K Jul 3 18:57 root
tail 查看文件 显示最后20行
tail -n 20 error.log
tail 查看文件 时时刷新日志显示
tail -f access.log
全局查找文件
find / -name nohup.out
/mnt/nohup.out