简介:在windows下,我们通过计算机-属性 来查看相关的系统信息:系统名称,cpu,内存等等,同样,在linux下面,我们可以通过本文提供的方法来查询相关信息。
1. 查询系统版本
1.1终端输入:file /bin/ls
root@hyk-ubuntu:/proc# file /bin/ls
/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
1.2终端里输入:lsb_release -a
结果:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 6.10
Release: 6.10
Codename: edgy
1.3终端里面输入:cat /etc/issue
实例:
root@hyk-ubuntu:/proc# cat /etc/issue
Ubuntu 11.04 \n \l
2. 查询内核信息
2.1终端里输入:uname -r
实例:
root@hyk-ubuntu:/proc# uname -r
2.6.38-8-generic
2.2终端里输入:cat /proc/version
实例:
root@hyk-ubuntu:/proc# cat /proc/version
Linux version 2.6.38-8-generic (buildd@vernadsky) (gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu3) ) #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011
3. 查询内存信息
3.1终端里输入:top
实例:
root@hyk-ubuntu:/proc# top
top - 16:55:22 up 2:16, 3 users, load average: 0.05, 0.06, 0.11
Tasks: 184 total, 2 running, 181 sleeping, 0 stopped, 1 zombie
Cpu(s): 9.8%us, 4.6%sy, 0.0%ni, 85.6%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 2018672k total, 1848124k used, 170548k free, 79768k buffers
Swap: 2052092k total, 0k used, 2052092k free, 905128k cached
对输出的解释:
total:总计物理内存的大小;used:已使用多大;free:可用有多少;Shared:多个进程共享的内存总额;
Buffers/cached:磁盘缓存的大小;第三行(-/+ buffers/cached):used:已使用多大;free:可用有多少。
3.2终端里输入:free
实例:
root@hyk-ubuntu:/proc# free
total used free shared buffers cached
Mem: 2018672 1956216 62456 0 63548 988136
-/+ buffers/cache: 904532 1114140
Swap: 2052092 8 2052084
解释:同上
3.3终端里输入:cat /proc/meminfo
实例:
root@hyk-ubuntu:/proc# cat /proc/meminfo
MemTotal: 2018672 kB
MemFree: 130160 kB
Buffers: 69452 kB
Cached: 966992 kB
SwapCached: 0 kB
Active: 1066168 kB
Inactive: 717752 kB
Active(anon): 686088 kB
Inactive(anon): 217156 kB
Active(file): 380080 kB
Inactive(file): 500596 kB
Unevictable: 36 kB
Mlocked: 36 kB
HighTotal: 1145544 kB
HighFree: 6852 kB
4. 查询cpu信息
4.1终端里输入:cat /proc/cpuinfo
实例:
root@hyk-ubuntu:/proc# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Core(TM)2 Duo CPU T7300 @ 2.00GHz
stepping : 11
cpu MHz : 800.000
cache size : 4096 KB
.........
.........
5. 查询硬盘信息
5.1终端里输入:df -h
实例:
root@hyk-ubuntu:/proc# df -h
文件系统 容量 已用 可用 已用%% 挂载点
/dev/sda1 109G 2.8G 100G 3% /
none 980M 692K 979M 1% /dev
none 986M 1.8M 984M 1% /dev/shm
none 986M 104K 986M 1% /var/run
none 986M 0 986M 0% /var/lock