How to view logs in a Linux system (common commands)

Source: Internet
Author: User

Cat
Tail-f


Log file description
/var/log/message system startup information and error log, which is one of the most commonly used logs in red Hat Linux
/var/log/secure Security-related log information
/var/log/maillog message-related log information
/var/log/cron log information related to timed tasks
/var/log/spooler log information related to UUCP and news devices
/var/log/boot.log Daemon starts and stops related log messages




System:
# uname-a # View kernel/Os/cpu information
# cat/etc/issue
# cat/etc/redhat-release # 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 of loaded kernel modules
# env # View Environment variables
Resources:
# free-m # View memory usage and swap area 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 uptime, number of users, load
# cat/proc/loadavg # View System load
Disks and partitions:
# Mount | COLUMN-T # Viewing the status of a mounted partition
# fdisk-l # View all partitions
# swapon-s # View all swap partitions
# hdparm-i/dev/hda # View disk parameters (for IDE devices only)
# DMESG | grep IDE # View IDE device detection status at startup
Internet:
# ifconfig # View the properties of all network interfaces
# iptables-l # View firewall settings
# route-n # View the 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 # Real-time display of process status (in another article there is a detailed introduction)
User:
# w # View active Users
# ID < user name > # view specified user information
# last # View user log in log
# cut-d:-f1/etc/passwd # View All users of the system
# cut-d:-f1/etc/group # View all system groups
# crontab-l # View Current user's scheduled tasks
Service:
# chkconfig–list # List all system services
# Chkconfig–list | grep on # Lists all startup system services
Program:
# rpm-qa # View all installed Packages
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.