Some practical operations for Linux to view the system's logs

Source: Internet
Author: User

Last-a the host name or IP address from which to log in to the system, displayed on the last line. -d Specifies the record file. Specifies the record file. Converts an IP address into a host name. -F <记录文件> Specifies the record file. -N <显示列数> Or <显示列数>  Sets the number of displayed columns for the list. -R does not display the host name or IP address of the login system. -X Display system shutdown, reboot, and execution level changes and other information see all reboots, Shutdown records last | grep Rebootlast | grep shutdownhistory Lists all the history: [[Email protected]] # Historical lists only the last 10 records: [[[Email protected]] # 10 (note, History and 10 have spaces in the middle) use the command record number to execute the command, execute the 99th command in the historical list [[email protected]] #!99 (! And 99 no spaces in the middle) to repeat the previous command [[email  Protected]] #!! Executes the last command that starts with RPM (the!?? Represents a string that can be randomly lost, the shell will search forward from the last history command, and the first matching command will be executed. ) [[[email protected]] #!rpm list all history by screen: [[[email protected]]#] | More immediately clears history of all current History commands [[email protected]] #history-ccat, tail and watch system all the logs are in the/var/log under their own view (specific use can be self-check, The appendix lists some commonly used logs) Cat/var/log/syslog etc. cat/var/log/*.logtail-f if the log is updated, how to view tail-f/var/log/messages can also use watch-d-N 1 Cat /var/log/messages-d means highlighting different places, and-n indicates how many seconds to refresh. This instruction does not return directly to the command line, but rather to print the new additions in the log file in real time, a feature that is very effective for viewing logs. If you want to terminate the output, press CTRL + C. In addition to more, less, dmesg|more, here does not make a list, because there are too many commands, the key to see personal preferences and business needs. The above-mentioned Linux log files describe the information and error logs of/var/log/message system startup , is one of the most common logs in red Hat Linux/var/log/secure and security phase/var/log/maillog log information associated with the message/var/log/cron log information related to the scheduled task/var/log/spooler log information related to UUCP and news devices/var/log/boot.log The daemon starts and stops related log messages/var/log/wtmp the log file permanently records each user's logon, logoff, and system startup, downtime events

Linux viewing the system's logs for some useful operations

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.