Linux system to view common commands

system
# uname -a # View kernel/OS/CPU information
# head -n 1 /etc/issue # View OS version
# cat /proc/cpuinfo # View CPU information
# hostname # View computer name
# lspci -tv # List all PCI devices
# lsusb -tv # List all USB devices
# lsmod # List loaded kernel modules
# env # View environment variables
 
resource
# free -m # View memory usage and swap usage
# df -h # View the usage of each partition
# du -sh <directory name> # View the size of the specified directory
# grep MemTotal /proc/meminfo # View total memory
# grep MemFree /proc/meminfo # View the amount of free memory
# uptime # View system running time, number of users, load
# cat /proc/loadavg # View system load
 
Disks and Partitions
# mount | column -t # View the mounted partition status
# fdisk -l # View all partitions www.2cto.com  
# swapon -s # View all swap partitions
# hdparm -i /dev/hda # View disk parameters (only for IDE devices)
# dmesg | grep IDE # View IDE device detection status at startup
 
The internet
# ifconfig # View properties of all network interfaces
# iptables -L # View firewall settings
# route -n # View routing table
# netstat -lntp # View all listening ports
# netstat -antp # View all established connections
# netstat -s # View network statistics
 
process
# ps -ef # View all processes
# top # 实时显示进程状态
用户
# w # 查看活动用户
# id <用户名> # 查看指定用户信息
# last # 查看用户登录日志
# cut -d: -f1 /etc/passwd # 查看系统所有用户
# cut -d: -f1 /etc/group # 查看系统所有组
# crontab -l # 查看当前用户的计划任务
 
服务
# chkconfig --list # 列出所有系统服务
# chkconfig --list | grep on # 列出所有启动的系统服务
程序
# rpm -qa # 查看所有安装的软件包
 
常用命令整理如下:
查看主板的序列号: dmidecode | grep -i ’serial number’
用硬件检测程序kuduz探测新硬件:service kudzu start ( or restart)
查看CPU信息:cat /proc/cpuinfo [dmesg | grep -i 'cpu'][dmidecode -t processor]
查看内存信息:cat /proc/meminfo [free -m][vmstat]
查看板卡信息:cat /proc/pci
查看显卡/声卡信息:lspci |grep -i ‘VGA’[dmesg | grep -i 'VGA']
查看网卡信息:dmesg | grep -i ‘eth’[cat /etc/sysconfig/hwconf | grep -i eth][lspci | grep -i 'eth']  www.2cto.com  
<!--more-->
查看PCI信息:lspci (相比cat /proc/pci更直观)
查看USB设备:cat /proc/bus/usb/devices
查看键盘和鼠标:cat /proc/bus/input/devices
查看系统硬盘信息和使用情况:fdisk & disk – l & df
查看各设备的中断请求(IRQ):cat /proc/interrupts
查看系统体系结构:uname -a
 
查看及启动系统的32位或64位内核模式:isalist –v [isainfo –v][isainfo –b]
dmidecode查看硬件信息,包括bios、cpu、内存等信息
测定当前的显示器刷新频率:/usr/sbin/ffbconfig –rev \?
查看系统配置:/usr/platform/sun4u/sbin/prtdiag –v
查看当前系统中已经应用的补丁:showrev –p
显示当前的运行级别:who –rH
查看当前的bind版本信息:nslookup –class=chaos –q=txt version.bind
dmesg | more 查看硬件信息
lspci 显示外设信息, 如usb,网卡等信息
lsnod 查看已加载的驱动
 
lshw
psrinfo -v 查看当前处理器的类型和速度(主频)
prtconf -v 打印当前的OBP版本号  www.2cto.com  
iostat –E 查看硬盘物理信息(vendor, RPM, Capacity)
prtvtoc /dev/rdsk/c0t0d0s 查看磁盘的几何参数和分区信息
df –F ufs –o i 显示已经使用和未使用的i-node数目
isalist –v
 
对于“/proc”中文件可使用文件查看命令浏览其内容,文件中包含系统特定信息:
Cpuinfo 主机CPU信息
Dma 主机DMA通道信息
Filesystems 文件系统信息
Interrupts 主机中断信息
Ioprots 主机I/O端口号信息
Meninfo 主机内存信息
Version  Linux内存版本信息

备注: proc – process information pseudo-filesystem 进程信息伪装文件系统 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326782702&siteId=291194637