These commands are very useful, but the usage is not too high. you can collect them for future reference. Reprinted connection: http://my.oschina.net/hunterli/blog/140783
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
Resources
# Free-m # View memory usage and swap zone usage # df-h # view the usage of each partition # du-sh
<目录名>
# View the size of a specified directory # grep MemTotal/proc/meminfo # view the total memory # grep MemFree/proc/meminfo # view the amount of idle memory # uptime # view the system running time, number of users, and load # cat/proc/loadavg # View system load
Disks and partitions
# Mount | column-t # view the status of the mounted partition # fdisk-l # View All partitions # swapon-s # View all swap partitions # hdparm-I/dev/hda # View disk parameter (applicable only to IDE devices) # dmesg | grep IDE # view the IDE device detection status at startup
Network
# Ifconfig # view the attributes of all network interfaces # iptables-L # View firewall settings # route-n # View route tables # netstat-lntp # View all listening ports # netstat-antp # View all established connection # netstat-s # View network statistics
Process
# Ps-ef # View all processes # top # Display process status in real time
User
# W # View active users # id
<用户名>
# Viewing specified user information # last # viewing user logon logs # cut-d:-f1/etc/passwd # viewing all users in the system # cut-d: -f1/etc/group # View all groups in the system # crontab-l # view the scheduled tasks of the current user
Service
# Chkconfig -- list # list all system Services # chkconfig -- list | grep on # list all started System Services
Program
# Rpm-qa # View all installed software packages
View CPU information (model)
# Cat/proc/cpuinfo | grep name | cut-f2-d: | uniq-c
8 Intel (R) Xeon (R) CPU E5410 @ 2.33 GHz
(We can see eight logical CPUs and the CPU model)
# Cat/proc/cpuinfo | grep physical | uniq-c
4 physical id: 0
4 physical id: 1
(It means two 4-core CPUs)
# Getconf LONG_BIT
32
(This indicates that the current CPU runs in 32bit mode, but does not indicate that the CPU does not support 64bit)
# Cat/proc/cpuinfo | grep flags | grep 'LM '| wc-l
8
(If the result is greater than 0, 64bit computing is supported. lm indicates long mode, and lm indicates 64bit)
Let's take a full look at the cpu details, but we don't care about most of them.
# Dmidecode | grep 'processor information'
View memory information
# Cat/proc/meminfo
# Uname-
Linux euis1 2.6.9-55. ELsmp #1 SMP Fri Apr 20 17:03:35 EDT 2007 i686 i686 i386 GNU/Linux
(View the kernel information of the current operating system)
# Cat/etc/issue | grep Linux
Red Hat Enterprise Linux AS release 4 (Nahant Update 5)
(View the released version of the current operating system)
View the machine model
# Dmidecode | grep "Product Name"
View Nic information
# Dmesg | grep-I eth