How to view logs in Linux system (common commands)

  

cat

tail -f

Log file description

  1. /var/log/Message The information and error log after system startup is one of the most commonly used logs in Red Hat Linux
  2. /var/log/secure Security-related log information
  3. /var/log/Maillog Log information related to mail
  4. /var/log/cron Log information related to scheduled tasks
  5. /var/log/spooler Log information related to UUCP and news devices
  6. /var/log/boot.log Daemon Start and Stop Related Log Messages

    System:

    1. # uname -a # View Kernel /OS/CPU information
    2. # cat /etc/issue
    3. # cat /etc/redhat-release # View operating system version
    4. # cat /proc/cpuinfo # View CPU information
    5. # hostname # View computer name
    6. # lspci -tv # List all PCI devices
    7. # lsusb -tv # List all USB devices
    8. # lsmod # Listing loaded kernel modules
    9. # env # Viewing environment variables

      Resources:

      1. # free -m # View Memory usage and swap usage
      2. # df -h # View partition usage
      3. # du -sh <directory name> # View the size of the specified directory
        < # grep MemTotal /proc/meminfo # View memory total
      4. # grep MemFree /proc/meminfo # View free memory
      5. # uptime # View system running time, number of users, load
      6. # cat /proc/loadavg # View system load

        Disks and partitions:

        1. # mount |  Column -t # View the mounted partition status
        2. # fdisk -l # View all partitions
        3. # swapon -s # View all swap partitions
        4. # hdparm -i /Dev/hda # View disk parameters (only for IDE devices)
        5. #dmesg |  Grep IDE # View IDE device detection status at startup

          Network:

          1. # ifconfig # View all network interface properties
          2. # iptables -L # View firewall settings
          3. # route -n # View routing table
          4. # netstat -lntp # View all listening ports
          5. # netstat -antp # View all established Connections
          6. #netstat -s # View Network Statistics

            Process:

            1. # ps -ef # View all processes
            2. # top # Real-time display of process status (detailed in another article)

              User:

              1. # w # View event User
              2. # id <username> # View specified user information
              3. # last # View user login log
              4. #cut -d: -f1 /etc/passwd # View all users of the system
              5. #cut -d: -f1 /etc/group # View all groups in the system
              6. # crontab -l # View the current user's scheduled tasks

                Service:

                1. # chkconfig –list # List all System Services
                2. # chkconfig –list |  Grep on # List all started system services

                  Programs:

                  1. # rpm -qa # View all installed packages

                    Original link: http://mushme.iteye.com/blog/1001478

Copyright © Windows knowledge All Rights Reserved