欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

查看Linux信息

程序员文章站 2022-04-20 19:17:33
Linux信息 查看CPU的相关信息 查看内存的相关信息 查看挂接的分区状态 查看硬盘和分区分布 查看硬盘和分区分布 查看硬盘使用情况 查看系统的所有网络接口 查看系统的键盘和鼠标 ......

linux信息

查看cpu的相关信息

lscpu
[dzlua@home ~]$ lscpu
architecture:          x86_64
cpu op-mode(s):        32-bit, 64-bit
byte order:            little endian
cpu(s):                4
on-line cpu(s) list:   0-3
thread(s) per core:    1
core(s) per socket:    2
socket(s):             2
numa node(s):          1
vendor id:             genuineintel
cpu family:            6
model:                 158
model name:            intel(r) core(tm) i5-8400 cpu @ 2.80ghz
stepping:              10
cpu mhz:               2808.001
bogomips:              5616.00
hypervisor vendor:     vmware
virtualization type:   full
l1d cache:             32k
l1i cache:             32k
l2 cache:              256k
l3 cache:              9216k
numa node0 cpu(s):     0-3
[dzlua@home ~]$ 

查看内存的相关信息

cat /proc/meminfo |head -20
[dzlua@home ~]$ cat /proc/meminfo |head -20
memtotal:        2037232 kb
memfree:         1485700 kb
buffers:           64852 kb
cached:           320120 kb
swapcached:            0 kb
active:           266920 kb
inactive:         131304 kb
active(anon):      13260 kb
inactive(anon):      152 kb
active(file):     253660 kb
inactive(file):   131152 kb
unevictable:           0 kb
mlocked:               0 kb
swaptotal:       4046844 kb
swapfree:        4046844 kb
dirty:                 4 kb
writeback:             0 kb
anonpages:         13476 kb
mapped:             6716 kb
shmem:               164 kb
[root@dev proc]# cat /proc/meminfo
memtotal:        2037232 kb
memfree:         1485824 kb
buffers:           64852 kb
cached:           320120 kb
swapcached:            0 kb
active:           266904 kb
inactive:         131304 kb
active(anon):      13244 kb
inactive(anon):      152 kb
active(file):     253660 kb
inactive(file):   131152 kb
unevictable:           0 kb
mlocked:               0 kb
swaptotal:       4046844 kb
swapfree:        4046844 kb
dirty:                 4 kb
writeback:             0 kb
anonpages:         13248 kb
mapped:             6716 kb
shmem:               164 kb
slab:              97036 kb
sreclaimable:      34284 kb
sunreclaim:        62752 kb
kernelstack:        2704 kb
pagetables:         1716 kb
nfs_unstable:          0 kb
bounce:                0 kb
writebacktmp:          0 kb
commitlimit:     5065460 kb
committed_as:      64124 kb
vmalloctotal:   34359738367 kb
vmallocused:      183512 kb
vmallocchunk:   34359539832 kb
hardwarecorrupted:     0 kb
anonhugepages:         0 kb
hugepages_total:       0
hugepages_free:        0
hugepages_rsvd:        0
hugepages_surp:        0
hugepagesize:       2048 kb
directmap4k:       12288 kb
directmap2m:     1036288 kb
directmap1g:     1048576 kb
[dzlua@home ~]$ 

查看挂接的分区状态

fdisk -l | grep disk
[dzlua@home ~]$ fdisk -l | grep disk
disk /dev/sda: 107.4 gb, 107374182400 bytes
disk identifier: 0x0008c221
disk /dev/mapper/vg_dev-lv_root: 53.7 gb, 53687091200 bytes
disk identifier: 0x00000000
disk /dev/mapper/vg_dev-lv_swap: 4143 mb, 4143972352 bytes
disk identifier: 0x00000000
disk /dev/mapper/vg_dev-lv_home: 49.0 gb, 49014636544 bytes
disk identifier: 0x00000000
[dzlua@home ~]$ 

查看硬盘和分区分布

lsblk
[dzlua@home ~]$ lsblk
name                      maj:min rm  size ro type mountpoint
sr0                        11:0    1 1024m  0 rom
sda                         8:0    0  100g  0 disk
├─sda1                      8:1    0  500m  0 part /boot
└─sda2                      8:2    0 99.5g  0 part
  ├─vg_dev-lv_root (dm-0) 253:0    0   50g  0 lvm  /
  ├─vg_dev-lv_swap (dm-1) 253:1    0  3.9g  0 lvm  [swap]
  └─vg_dev-lv_home (dm-2) 253:2    0 45.7g  0 lvm  /home
[dzlua@home ~]$ 

查看硬盘和分区分布

mount | column -t
[dzlua@home ~]$ mount | column -t
/dev/mapper/vg_dev-lv_root  on  /                         type  ext4            (rw)
proc                        on  /proc                     type  proc            (rw)
sysfs                       on  /sys                      type  sysfs           (rw)
devpts                      on  /dev/pts                  type  devpts          (rw,gid=5,mode=620)
tmpfs                       on  /dev/shm                  type  tmpfs           (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1                   on  /boot                     type  ext4            (rw)
/dev/mapper/vg_dev-lv_home  on  /home                     type  ext4            (rw)
none                        on  /proc/sys/fs/binfmt_misc  type  binfmt_misc     (rw)
[dzlua@home ~]$ 

查看硬盘使用情况

df -ht
[dzlua@home ~]$ df -ht
filesystem                  type   size  used avail use% mounted on
/dev/mapper/vg_dev-lv_root  ext4    50g   12g   35g  26% /
tmpfs                       tmpfs  931m     0  931m   0% /dev/shm
/dev/sda1                   ext4   477m   49m  403m  11% /boot
/dev/mapper/vg_dev-lv_home  ext4    45g   52m   43g   1% /home
[dzlua@home ~]$ 

查看系统的所有网络接口

ifconfig -a
[dzlua@home ~]$ ifconfig -a
eth1      link encap:ethernet  hwaddr 00:0c:29:2b:be:e5
          inet addr:192.168.5.212  bcast:192.168.5.255  mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe2b:bee5/64 scope:link
          up broadcast running multicast  mtu:1500  metric:1
          rx packets:841987 errors:0 dropped:0 overruns:0 frame:0
          tx packets:184594 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          rx bytes:942751394 (899.0 mib)  tx bytes:99686566 (95.0 mib)

lo        link encap:local loopback
          inet addr:127.0.0.1  mask:255.0.0.0
          inet6 addr: ::1/128 scope:host
          up loopback running  mtu:65536  metric:1
          rx packets:75 errors:0 dropped:0 overruns:0 frame:0
          tx packets:75 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          rx bytes:6052 (5.9 kib)  tx bytes:6052 (5.9 kib)
[dzlua@home ~]$ 

查看系统的键盘和鼠标

cat /proc/bus/input/devices
[dzlua@home ~]$ cat /proc/bus/input/devices
i: bus=0019 vendor=0000 product=0001 version=0000
n: name="power button"
p: phys=lnxpwrbn/button/input0
s: sysfs=/devices/lnxsystm:00/lnxpwrbn:00/input/input0
u: uniq=
h: handlers=kbd event0
b: prop=0
b: ev=3
b: key=10000000000000 0

i: bus=0017 vendor=0001 product=0001 version=0100
n: name="macintosh mouse button emulation"
p: phys=
s: sysfs=/devices/virtual/input/input1
u: uniq=
h: handlers=mouse0 event1
b: prop=0
b: ev=7
b: key=70000 0 0 0 0
b: rel=3

i: bus=0011 vendor=0002 product=0005 version=0000
n: name="imps/2 generic wheel mouse"
p: phys=isa0060/serio1/input0
s: sysfs=/devices/platform/i8042/serio1/input/input2
u: uniq=
h: handlers=mouse1 event2
b: prop=0
b: ev=7
b: key=70000 0 0 0 0
b: rel=103

i: bus=0011 vendor=0001 product=0001 version=ab41
n: name="at translated set 2 keyboard"
p: phys=isa0060/serio0/input0
s: sysfs=/devices/platform/i8042/serio0/input/input3
u: uniq=
h: handlers=kbd event3
b: prop=0
b: ev=120013
b: key=402000000 3803078f800d001 feffffdfffefffff fffffffffffffffe
b: msc=10
b: led=7
[dzlua@home ~]$