Organize Linux to view some of the frequently used commands for system logs

Source: Internet
Author: User

Organize Linux to view some of the frequently used commands for system logs

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, another boot, and changes in operational levels

Here's a look at the full reboot, shutdown record

Last | grep Rebootlast | grep shutdown


History

List all the history records:

[[email protected]] # History

Just list the latest 10 records:

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

Run the command using the command record number, run the 99th command in the history list

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

Run the previous command repeatedly

[Email Protected]linux] #!!

Run the last command that starts with RPM (!?? Represents a string that can be randomly lost, the shell will search forward from the last history command, and the first match will be run. )

[[email protected]] #!rpm

List all history by screen:

[[Email protected]]# History | More

Clear the history of all historical commands now.

[[email protected]] #history-C

cat, tail and watch

All of the system's logs are under/var/log (detailed use can be self-check, appendix lists some frequently used logs)

Cat/var/log/syslog et Cat/var/log/*.log


tail-f

Assume that the log is updated. How to view tail-f/var/log/messages in real time

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 useful 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 of the command too much, the key to see personal preferences and business needs. The ones that are often used by individuals

Linux log file description

/var/log/message system startup information and error logs are one of the most frequently 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 every user logon, logoff, and system startup, downtime events



Extended Reading

The Linux frequently used commands series technical Articles to organize collections

1 Introduction to Linux Curl Usage (1)

2Linux Find command-path-prune role specific introduction

3Linux How to use the Locate command to find data to find the specified file

Summary of how to view memory usage under 4Linux

5CentOS How to set the DVD as the default yum source for download and installation of software on DVD

6Linux tar command tar time Stamp in the future Problem solving method

7Linux How to use the awk Text Processing tool to sort arrays

8CentOS 6.5 System setting fixed IP method

9Linux Normal Form Usage guide

wget command operation example for downloading files in 10Linux system

11Linux PS Command Combat

12 those features of the DF command that you do not know under Linux

1320 Linux Command interview quiz

144 Most popular open source code editors for Linux platforms

15Ubuntu Text Editor vi workaround for error using arrow keys

16Linux view some frequently used command summaries of system logs

17Linux How to improve the copy efficiency of large files to save time

What commands does the 18linux system use to check port occupancy?

19Linux Text Search tool grep uses specific explanations

20Linux xargs Command

8 ways to count file lines in 21Shell script

22 Troubleshooting Long idle hours after SSH login disconnect

23centos User-related commands

24grep how to ignore filtering. SVN folder and how to ignore multiple folders

25centos User-related commands

26 Troubleshooting long idle hours after SSH login disconnect

27Apache, PHP hidden version number information

14 Practical examples of SORT commands in 28Linux (i)

2,914 examples of Linux grep commands

3,011 of Linux terminal commands that surprise you

31linux, Unix method of high-speed emptying files

32Centos view real-time traffic command for NIC

335 Classic Interesting Linux command-line tricks

34Linux Ctrl + Z usage

3,512 Linux Process Management commands introduced

36 tutorial on compressing and decompressing files using the tar command in a Linux system

7 commands for browsing Web pages and downloading files in 37Linux

In 38Linux. Useful commands for creating chat server, removing redundant packages

39 explain how to use the md5sum command in Linux system

Organize Linux to view some of the frequently used commands for system logs

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.