Linux系统的详细信息查询可以通过多种命令来实现,以下是一些常用的命令及其输出信息的解释:
uname
命令uname
命令用于显示系统内核和版本信息。
uname -a
输出示例:
Linux hostname 5.4.0-72-generic #80-Ubuntu SMP Mon Apr 12 10:00:32 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Linux
:操作系统类型。hostname
:主机名。5.4.0-72-generic
:内核版本。x86_64
:处理器架构。lsb_release
命令lsb_release
命令用于显示Linux发行版的详细信息。
lsb_release -a
输出示例:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
Distributor ID
:发行版ID。Description
:发行版详细描述。Release
:发行版版本号。Codename
:发行版代号。dmesg
命令dmesg
命令用于显示内核环缓冲区的内容,可以查看系统启动时的硬件信息和错误日志。
dmesg | head
输出示例:
[ 0.000000] Linux version 5.4.0-72-generic (buildd@lcy01-amd64-013) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #80-Ubuntu SMP Mon Apr 12 10:00:32 UTC 2021
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.4.0-72-generic root=UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx ro quiet splash vt.handoff=7
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Centaur CentaurHauls
cat /proc/cpuinfo
命令/proc/cpuinfo
文件包含了关于CPU的详细信息。
cat /proc/cpuinfo
输出示例:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 142
model name : Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
stepping : 9
microcode : 0xea
cpu MHz : 2800.000
cache size : 6144 KB
physical id : 0
siblings : 8
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit srbds
bogomips : 5600.00
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:
free -h
命令free
命令用于显示系统内存使用情况。
free -h
输出示例:
total used free shared buff/cache available
Mem: 7.7G 2.1G 1.2G 188M 4.3G 5.1G
Swap: 2.0G 0B 2.0G
total
:总内存。used
:已使用内存。free
:空闲内存。buff/cache
:缓冲区和缓存。available
:可用内存。df -h
命令df
命令用于显示文件系统的磁盘空间使用情况。
df -h
输出示例:
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 794M 1.1M 793M 1% /run
/dev/sda1 234G 45G 180G 20% /
tmpfs 3.9G 20M 3.9G 1% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/loop0 98M 98M 0 100% /snap/core/10583
/dev/loop1 56M 56M 0 100% /snap/core18/1944
/dev/loop2 30M 30M 0 100% /snap/snapd/8542
tmpfs 794M 16K 794M 1% /run/user/1000
Size
:文件系统大小。Used
:已使用空间。Avail
:可用空间。Use%
:使用百分比。Mounted on
:挂载点。top
命令top
命令用于实时显示系统中各个进程的资源占用情况。
top
输出示例:
top - 14:23:45 up 1 day, 3:15, 2 users, load average: 0.00, 0.01, 0.05
Tasks: 196 total, 1 running, 195 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.3 us, 0.0 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 7986.4 total, 2168.0 free, 2097.4 used, 3721.0 buff/cache
MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 5232.6 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1234 user 20 0 1234M 123M 123M S 0.3 1.5 0:01.23 process_name
Tasks
:任务总数。%Cpu(s)
:CPU使用情况。MiB Mem
:内存使用情况。MiB Swap
:交换空间使用情况。PID
:进程ID。USER
:进程所有者。PR
:优先级。NI
:nice值。VIRT
:虚拟内存大小。RES
:常驻内存大小。SHR
:共享内存大小。%CPU
:CPU使用百分比。%MEM
:内存使用百分比。TIME+
:累计CPU时间。COMMAND
:进程命令。ifconfig
或 ip addr
命令用于显示网络接口配置信息。
ifconfig
或
ip addr
输出示例(ip addr
):
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:16:3e:00:00:01 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.100/24 brd 192.168.1.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::216:3eff:fe00:1/64 scope link
valid_lft forever preferred_lft forever
lo
:本地回环接口。eth0
:以太网接口。inet
:IPv4地址。inet6
:IPv6地址。通过这些命令,你可以全面了解Linux系统的硬件配置、软件版本、内存使用、磁盘空间、进程状态以及网络配置等详细信息。
领取专属 10元无门槛券
手把手带您无忧上云