linux查看系统信息命令

1.查看linux内核版本

[root@master ~]# uname -r
3.10.0-123.el7.x86_64
[root@master ~]# uname -a
Linux master 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

2.查看文件系统的磁盘大小和剩余空间大小

[root@master ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   20G   15G  4.5G  77% /
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G     0  1.9G   0% /dev/shm
tmpfs                    1.9G  8.6M  1.9G   1% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda1                297M   88M  210M  30% /boot
tmpfs                    378M     0  378M   0% /run/user/0

3.显示系统运行时间

[root@master ~]# uptime
 23:17:26 up 5 min,  1 user,  load average: 0.01, 0.09, 0.05

依次显示:
现在时间、系统运行时间、目前有多少登录用户、在过去的1分钟、5分钟
15分钟内的平均负载

4.查看当前系统内存使用情况:free 参数

参  数:
-b  以Byte为单位显示内存使用情况。
-k  以KB为单位显示内存使用情况。
-m  以MB为单位显示内存使用情况。
-h   以比较人性化的方式显示内存使用情况。
-o  不显示缓冲区调节列。
-s   <间隔秒数>  持续观察内存使用状况。
-t  显示内存总和列。
-V  显示版本信息。   
[root@master ~]# free -h
             total       used       free     shared    buffers     cached
Mem:          3.7G       255M       3.4G       8.6M       764K        83M
-/+ buffers/cache:       171M       3.5G
Swap:         523M         0B       523M

total 列显示系统总的可用物理内存和交换空间大小。
used 列显示已经被使用的物理内存和交换空间。
free 列显示还有多少物理内存和交换空间可用使用。
shared 列显示被共享使用的物理内存大小。

第二行(mem)的used/free与第三行(-/+ buffers/cache)used/free的区别。
这两个的区别在于使用的角度来看,第一行是从OS的角度来看,因为对于OS,buffers/cached 都是属于被使用,所以他的可用内存是8908KB,已用内存是377116KB,其中包括,内核(OS)使用+Application(X,Oracle,etc)使用的+buffers+cached.

第三行所指的是从应用程序角度来看,对于应用程序来说,buffers/cached 是等于可用的,因为buffer/cached是为了提高文件读取的性能,当应用程序需在用到内存的时候,buffer/cached会很快地被回收。
所以从应用程序的角度来说,可用内存=系统free( memory+buffers+cached.)

5.查看CPU的详细硬件信息

[root@master ~]# cat /proc/cpuinfo 
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 154
model name	: 12th Gen Intel(R) Core(TM) i7-12700H
stepping	: 3
microcode	: 0x41e
cpu MHz		: 2688.001
cache size	: 24576 KB
physical id	: 0
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 32
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch arat xsaveopt fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap
bogomips	: 5376.00
clflush size	: 64
cache_alignment	: 64
address sizes	: 45 bits physical, 48 bits virtual
power management:

6.查看cpu的使用情况和正在运行的进程情况:
在这里插入图片描述
7.查看登录日志:

[root@master ~]# last
root     pts/0        192.168.16.1     Mon Oct  9 23:12   still logged in   
reboot   system boot  3.10.0-123.el7.x Mon Oct  9 23:12 - 23:45  (00:33)    
root     pts/0        192.168.16.1     Sun Oct  8 21:50 - crash (1+01:21)   
reboot   system boot  3.10.0-123.el7.x Sun Oct  8 21:49 - 23:45 (1+01:56)   
root     pts/0        192.168.16.1     Thu Aug 31 16:45 - 16:46  (00:00)    
reboot   system boot  3.10.0-123.el7.x Thu Aug 31 16:45 - 23:45 (39+07:00)  
reboot   system boot  3.10.0-123.el7.x Thu Aug 31 16:45 - 16:45  (00:00)    
root     pts/0        192.168.16.1     Wed Aug 30 17:53 - crash  (22:51)    
root     tty1                          Wed Aug 30 17:52 - crash  (22:52)    
reboot   system boot  3.10.0-123.el7.x Wed Aug 30 17:52 - 16:45  (22:53)    
root     pts/0        192.168.16.1     Wed Aug 30 17:47 - down   (00:04)    
root     pts/0        192.168.16.1     Wed Aug 30 16:40 - 17:47  (01:06)    
reboot   system boot  3.10.0-123.el7.x Wed Aug 30 16:40 - 17:51  (01:11)    
root     pts/0        192.168.16.1     Mon Aug 28 21:52 - crash (1+18:48)   
reboot   system boot  3.10.0-123.el7.x Mon Aug 28 21:47 - 17:51 (1+20:03)   
root     pts/0        192.168.16.1     Mon Jul 24 21:01 - 00:28  (03:27)    
root     pts/2        192.168.16.1     Mon Jul 24 19:47 - 20:29  (00:42)    
root     pts/1        192.168.16.1     Mon Jul 24 19:21 - 19:47  (00:25)    
root     pts/1        192.168.16.1     Mon Jul 24 18:50 - 19:20  (00:30)    
root     pts/0        192.168.16.1     Mon Jul 24 17:05 - 20:59  (03:54)    
reboot   system boot  3.10.0-123.el7.x Mon Jul 24 17:04 - 17:51 (37+00:47)  
root     pts/0        192.168.16.1     Tue Jun 13 17:05 - crash (40+23:58)  
root     pts/0        192.168.16.1     Tue Jun 13 00:11 - 17:05  (16:53)    
root     pts/0        192.168.16.1     Tue Jun 13 00:11 - 00:11  (00:00)    
root     pts/1        192.168.16.1     Tue Jun 13 00:10 - 00:11  (00:01)    
root     pts/0        192.168.16.1     Tue Jun 13 00:00 - 00:10  (00:10)    
root     tty1                          Mon Jun 12 23:51 - crash (41+17:13)  
reboot   system boot  3.10.0-123.el7.x Mon Jun 12 23:47 - 17:51 (78+18:04)  

wtmp begins Mon Jun 12 23:47:41 2023

8.查看登录用户信息:w 用户名

[root@master ~]# w root
 23:46:13 up 34 min,  1 user,  load average: 0.08, 0.03, 0.05
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0     23:12    5.00s  0.02s  0.00s w root

9.显示或者修改时间:

[root@master ~]# date
Mon Oct  9 23:47:23 CST 2023
date -s 日期(mm/dd/yy)或 时间(hh:mm:ss)
clock -w
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值