Skip to content

Linux command tips

zhanghui edited this page Dec 22, 2016 · 4 revisions

How to check hardware info

all hardware info

dmsg | more dmidecode |more

cpu info

cat /proc/cpuinfo |more

check cpu bit

getconf LONG_BIT

check memory and swap

cat /proc/meminfo |more free -m top

list all pci device info

lspci -tv

check host name

hostname

list environment config & resource

env

check system partition useage

df -h

check folder size

du -sh

check system run time, user and load

uptime top

check network hardware info

lspci | grep -i "eth" ethtool eth0

mount | column -t # 查看挂接的分区状态

fdisk -l # 查看所有分区

swapon -s # 查看所有交换分区

hdparm -i /dev/hda # 查看磁盘参数(仅适用于IDE设备)

dmesg | grep IDE # 查看启动时IDE设备检测状况 网络

ifconfig # 查看所有网络接口的属性

iptables -L # 查看防火墙设置

route -n # 查看路由表

netstat -lntp # 查看所有监听端口

netstat -antp # 查看所有已经建立的连接

netstat -s # 查看网络统计信息 进程

ps -ef # 查看所有进程

top # 实时显示进程状态 用户

w # 查看活动用户

id # 查看指定用户信息

last # 查看用户登录日志

cut -d: -f1 /etc/passwd # 查看系统所有用户

cut -d: -f1 /etc/group # 查看系统所有组

crontab -l # 查看当前用户的计划任务 服务

chkconfig –list # 列出所有系统服务

chkconfig –list | grep on # 列出所有启动的系统服务 程序

rpm -qa # 查看所有安装的软件包

Clone this wiki locally