承蒙自己导师的大力支持,给我申请了一个美团服务器,让我用来做实验部署一些东西,突然来了兴趣,想好好看看这个服务器的系统信息,并回顾下查看系统信息的命令。(内容主要参照《linux如何查看系统信息》)
非常感谢刘老师的大力支持和不离不弃!!!
接下来开始系统信息查看之旅。
1、cpu信息的查看:
[email protected]:~# more /proc/cpuinfo |grep "model name"
model name : QEMU Virtual CPU version 1.1.2
[email protected]:~# grep "model name" /proc/cpuinfo
model name : QEMU Virtual CPU version 1.1.2
[email protected]:~# grep "model name" /proc/cpuinfo |cut -f2 -d:
QEMU Virtual CPU version 1.1.2
2、查看内存:
[email protected]:~# vi /proc/meminfo
MemTotal: 2050116 kB
MemFree: 1663960 kB
Buffers: 23220 kB
Cached: 270244 kB
SwapCached: 0 kB
Active: 114640 kB
Inactive: 224364 kB
Active(anon): 45676 kB
Inactive(anon): 276 kB
Active(file): 68964 kB
Inactive(file): 224088 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 2096444 kB
SwapFree: 2096444 kB
Dirty: 24 kB
Writeback: 0 kB
AnonPages: 45560 kB
Mapped: 10432 kB
Shmem: 392 kB
Slab: 22268 kB
SReclaimable: 13064 kB
SUnreclaim: 9204 kB
KernelStack: 592 kB
PageTables: 7000 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 3121500 kB
Committed_AS: 10310868 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 7896 kB
VmallocChunk: 34359724836 kB
HardwareCorrupted: 0 kB
AnonHugePages: 10240 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 34808 kB
DirectMap2M: 2062336 kB
(以上为全部的内存信息)
[email protected]:~# grep MemTotal /proc/meminfo
MemTotal: 2050116 kB
[email protected]:~# free -m
total used free shared buffers cached
Mem: 2002 375 1626 0 22 264
-/+ buffers/cache: 88 1913
Swap: 2047 0 2047
[email protected]:~# free -m|grep ‘Mem‘|awk ‘{print $2}‘
2002
3、查看linux CPU位数:
[email protected]:~# getconf LONG_BIT
64
4、查看linux版本:
全部版本信息:
[email protected]:~# more /etc/os-release
NAME="Ubuntu"
VERSION="14.04, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
[email protected]:~# more /etc/issue
Ubuntu 14.04 LTS \n \l
[email protected]:~# more /proc/version
Linux version 3.13.0-27-generic ([email protected]) (gcc version 4.8.2 (Ubuntu 4.8
.2-19ubuntu1) ) #50-Ubuntu SMP Thu May 15 18:06:16 UTC 2014
5、查看内核版本
[email protected]:~# uname -r
3.13.0-27-generic
[email protected]:~# uname -a
Linux nems 3.13.0-27-generic #50-Ubuntu SMP Thu May 15 18:06:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
6、查看时区以及修改时区:
[email protected]:~# date -R
Mon, 26 Oct 2015 21:55:03 +0800
[email protected]:~# mv /etc/localtime /etc/local
locale.alias localtime
[email protected]:~# mv /etc/localtime /etc/local
locale.alias localtime
[email protected]:~# mv /etc/localtime /etc/localtime.save
[email protected]:~# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[email protected]:~# date -R
Mon, 26 Oct 2015 21:56:52 +0800
7、主机名:
查看主机名:
[email protected]:~# hostname
nems
修改主机名:
[email protected]:/etc# vi hostname
nems
重启生效
修改成NEMS(Never Ending Mining Sentences)
8、查看selinux情况:
[[email protected] /]# sestatus
SELinux status: disabled
9、网络:
IP:
[email protected]:~# ifconfig|grep ‘inet addr:‘|grep -v ‘127.0.0.1‘|cut -d: -f2|awk ‘{print $1}‘
10.128.131.235
211.155.92.229
10、查看已经安装的安装包:
[email protected]:~# rpm -qa|wc -l
0
11、磁盘和分区情况:
[email protected]:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 25G 1.4G 22G 6% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 991M 4.0K 991M 1% /dev
tmpfs 201M 388K 200M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 1002M 0 1002M 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/vdc1 99G 60M 94G 1% /data
[email protected]:~# du -sh
444K
[email protected]:~# du /dev/vdc1 -sh
0 /dev/vdc1
[email protected]:~# du /dev/vda1 -sh
0 /dev/vda1
[email protected]:~# du /etc/ -sh
5.1M /etc/
12、查看默认语言:
[email protected]:~# echo $LANG $LANGUAGE
en_US.UTF-8 en_US:en
实验需要修改默认语言:
[email protected]:~# sudo vi /etc/default/locale #打开之后,输入以下代码
LANG="zh_CN"
LANGUAGE="zh_CN:zh"
LC_MESSAGES="zh_CN.UTF-8"
LC_CTYPE="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
重启生效:shutdown -r now
[email protected]:~# echo $LANG $LANGUAGE
zh_CN zh_CN:zh