Unix toolbox注解2之Linux系统状态用户和限制
本系列文章为笔者对Unix toolbox的一些个人注解,加入个人的一些元素,删减了其中一些对于freebsd的一些命令介绍,文中的内容笔者都一一验证过,放心使用。
系统
正在运行的内核和系统信息:
# uname -a # 获取内核版本(和BSD版本)
# lsb_release -a # 显示任何 LSB 发行版版本信息
# cat /etc/SuSE-release # 获取 SuSE 版本
# cat /etc/debian_version # 获取 Debian 版本
使用/etc/DISTR-release 其中DISTR(发行代号)= lsb (Ubuntu), redhat, gentoo, mandrake, sun(Solaris), 等等。
注:
Red Hat Enterprise Linux Server release 6.3 (Santiago)
# uptime # 显示系统开机运行到现在经过的时间
# hostname # 显示系统主机名
# hostname -i # 显示主机的 IP 地址
Display the IP address(es) of the host. Note that this works only if the host name can be resolved. Avoid using this option; use hostname --all-ip-addresses instead.
Display all network addresses of the host. This option enumerates all configured addresses on all network interfaces. The loopback interface and IPv6 link-local addresses are omitted. Contrary to option -i, this option does not depend on name resolution. Do not make any assumptions about the order of the output.
# man hier # 描述文件系统目录结构
# last reboot # 显示系统最后重启的历史记录
# dmesg # 检测到的硬件和启动的消息
# lsdev # 关于已安装硬件的信息1
# dd if=/dev/mem bs=1k skip=768 count=256 2>/dev/null | strings -n 8 # 读取 BIOS 信息
注:
[2:0:0:0] disk VMware, VMware Virtual S 1.0 /dev/sda
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
Subsystem: VMware Virtual Machine Chipset
# cat /proc/cpuinfo # CPU 信息
注:
用命令判断几个物理CPU,几个核等:
逻辑CPU个数:
# cat /proc/cpuinfo | grep “processor” | wc -l
物理CPU个数:
# cat /proc/cpuinfo | grep “physical id” | sort | uniq | wc -l
每个物理CPU中Core的个数:
# cat /proc/cpuinfo | grep “cpu cores” | wc -l
是否为超线程?
如果有两个逻辑CPU具有相同的”core id”,那么超线程是打开的。
每个物理CPU中逻辑CPU(可能是core, threads或both)的个数:
# cat /proc/cpuinfo | grep “siblings”
# cat /proc/meminfo # 内存信息
# grep MemTotal /proc/meminfo # 显示物理内存大小
# watch -n1 'cat /proc/interrupts' # 监控内核处理的所有中断
# free -m # 显示已用和空闲的内存信息 (-m 为 MB)2
# cat /proc/devices # 显示当前核心配置的设备
# lspci -tv # 显示 PCI 设备
# lsusb -tv # 显示 USB 设备
# lshal # 显示所有设备属性列表
# dmidecode # 显示从 BIOS 中获取的硬件信息
(参考笔者之前对该dmidecode的介绍:Linux dmidecode备忘)
转载于:https://blog.51cto.com/kumu1988/1088950