linux系统常用命令

时间:2022-12-09 22:50:25

1、查看linux系统内核版本命令
[root@localhost ~]# uname -r
3.8.13-35.3.1.el7uek.x86_64
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.8.13-35.3.1.el7uek.x86_64 #2 SMP Wed Jun 25 15:27:43 PDT 2014 x86_64 x86_64 x86_64 GNU/Linux

2、查看linux系统发行版本
[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.0 (Maipo)
[root@localhost ]# cat /etc/issue
Red Hat Enterprise Linux Server release 5.8 (Tikanga)
Kernel \r on an \m

3、查看linux系统具体版本号
[root@localhost ~]# cat /proc/version
Linux version 3.8.13-35.3.1.el7uek.x86_64 (mockbuild@ca-build56.us.oracle.com) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #2 SMP Wed Jun 25 15:27:43 PDT 2014

4、查看Linux硬盘大小
[root@localhost ~]# df -lh
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/ol-root 22G 7.2G 15G 33% /
devtmpfs 857M 0 857M 0% /dev
tmpfs 866M 84K 866M 1% /dev/shm
tmpfs 866M 9.0M 858M 2% /run
tmpfs 866M 0 866M 0% /sys/fs/cgroup
/dev/sda1 497M 143M 354M 29% /boot
/dev/sr0 3.9G 3.9G 0 100% /run/media/root/OL-7.0 Server.x86_64

5、查看内存大小
[root@localhost ~]# free -g
total used free shared buffers cached
Mem: 15 8 7 0 0 5
-/+ buffers/cache: 2 13
Swap: 17 0 17
You have new mail in /var/spool/mail/root
[root@localhost ~]# free -m
total used free shared buffers cached
Mem: 16049 8512 7537 0 198 5911
-/+ buffers/cache: 2401 13648
Swap: 18047 0 18047

查看内存占用百分比:
[root@rusky ~]# free -m | sed -n '2p' | awk '{print "used mem is "$3"M,total mem is "$2"M,used percent is "$3/$2*100"%"}'
used mem is 15765M,total mem is 15949M,used percent is 98.8463%

6、查看CPU个数
[root@localhost ]# ls /proc/acpi/processor/
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7

7、查看CPU详细信息
[root@YNCMldap195 /]# cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 21
model : 2
model name : AMD Opteron(tm) Processor 6348
stepping : 0
cpu MHz : 2800.033
cache size : 2048 KB
fpu : yes
fpu_exception : yes
cpuid level : 13
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 syscall nx mmxext fxsr_opt rdtscp lm rep_good constant_tsc nonstop_tsc pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm extapic abm sse4a misalignsse 3dnowprefetch osvw xop fma4
bogomips : 5600.06
TLB size : 1536 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: [8]

processor : 1
vendor_id : AuthenticAMD
cpu family : 21
model : 2
model name : AMD Opteron(tm) Processor 6348
stepping : 0
cpu MHz : 2800.033
cache size : 2048 KB
fpu : yes
fpu_exception : yes
cpuid level : 13
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 syscall nx mmxext fxsr_opt rdtscp lm rep_good constant_tsc nonstop_tsc pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm extapic abm sse4a misalignsse 3dnowprefetch osvw xop fma4
bogomips : 5600.06
TLB size : 1536 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: [8]

……

processor : 7