cat
tail -f
View the log file: (learning and summarizing from Dawning friends)
/var/log/message Information and error logs after system startup, one of the most commonly used logs in Red Hat Linux /var/log/secure Security related log information /var/log/maillog Mail related log information /var/log/cron Log information related to scheduled tasks /var/log/spooler log information related to UUCP and news devices /var/log/boot.log Log messages related to daemon start and stop
System (commonly used at work)
# uname -a # View kernel/OS/CPU information # cat /etc/issue # cat /etc/redhat-release # View operating system 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 (common commands in project system tuning)
# 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 (basic OS related commands)
# mount | column -t # View the mounted partition status # fdisk -l # view all partitions # 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
Network (a common sense that a technician must know)
# 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
Processes (developers, commands to be familiar with)
# ps -ef # View all processes # top # Display process status in real time
User (common knowledge a manager needs to know)
# w # View active users # id <username> # View the specified user information # last # View user login log # cut -d: -f1 /etc/passwd # View all users of the system # cut -d: -f1 /etc/group # View all groups in the system # crontab -l # View the current user's scheduled tasks
Service: (Common sense)
# chkconfig --list # list all system services # chkconfig –list | grep on # List all started system services
Procedure: When installing packages, use common sense
# rpm -qa # View all installed packages