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 < record file > specify record file.
-N < Show columns > or-< Show columns > set the number of displayed columns for the list.
-R does not display the host name or IP address of the login system.
-X displays information such as system shutdown, reboot, and execution level changes

See below for all reboots, shutdown logs

Shutdown
History

List all the history records:

[[email protected]Linux] # History

Only the last 10 records are listed:

[[email protected]] # History 10 (note, history and 10 have spaces in between)

Execute the command using the command record number, and execute the 99th command in the history list

[[email protected]] #!99 (! And 99 no spaces in the middle)

Repeat the previous command

[[email protected]] #!!

Executes the last command that starts with RPM (the!?? Represents a string that can be randomly lost, theshell will search forward from the last history command, and the first matching command will be executed. )

[[email protected]] #!rpm

List all history on a per-screen basis:

More

Immediately clears the history of all current historical commands

[[email protected]] #history-C
cat, tail and watch

System all the logs are under the/var/log to see their own (specific use can be self-check, appendix lists some common logs)

Cat/var/log/syslog et Cat/var/log/*.log
Tail-f

If the log is updated, how to view tail-f in real time/var/log/messages

You can also use watch-d-N 1 cat/var/log/messages

-d means highlighting different places, and-n indicates how many seconds are refreshed.

This instruction does not return directly to the command line, but instead prints the newly added content in the log file in real time,
This feature 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 the command too much, the key to see personal preferences and business needs. That's what you're used to.

Linux 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
/var/log/wtmp This log file permanently records each user logon, logoff, and system startup, downtime events

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

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.