The following are common viewing commands used by CentOS system. System # uname-a # View kernel/OS/CPU information # head-n1/etc/issue # View OS # cat/proc/cpuinfo # View CPU information # hostname # View computer name # lspci-TV # List all PCI devices # lsusb-TV # List
The following are common viewing commands used by CentOS system.
System
# Uname-a # View kernel/operating system/CPU information
# Head-n 1/etc/issue # view the operating system version
# Cat/proc/cpuinfo # View CPU information
# Hostname # view the 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 total memory
# Grep MemFree/proc/meminfo # view the amount of idle memory
# Uptime # View 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 parameters (only applicable 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 the route 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 # Display process status in real time
User
# W # View active users
# Id <用户名> # Viewing specified user information
# Last # View user logon logs
# Cut-d:-f1/etc/passwd # View 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
*****************
You can use netconfig to change the IP address. Unfortunately, you have to enter the complete IP address, mask, Gateway, and DNS each time.
Better than direct vi/etc/sysconfig/network-scripts/ifcfg-eth0
Then/etc/init. d/network restart is fast.
Change DNS, the fastest is vi/etc/resolv. conf, do not restart.
Restart httpd,/etc/init. d/httpd restart is faster than service httpdrestart, because the former can be completed and the latter cannot.
It is easier to use chkconfig to modify system services than setup.
Check the latest log. Use tail-f/var/log/xxx. log to make it easier than vi/var/log/xxx. log. If you cannot see it clearly, clear it before tail-n 0-f/var/log/xxx. log.
Use bash history.
Compress and decompress tar czvf/tar xzvf. Files are several times faster than files.
The scp is easier than samba to transmit files from two machines. For Windows, install cygwin, and use putty's own pscp.exe.
Test the network connection. nc 192.168.1.10 80 is better than telnet 192.168.1.10 80.
Modifying samba configurations and directly modifying/etc/samba/smb. conf is easier than GUI.