Organize Linux to view system logs for some common commands
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
Last | grep Rebootlast | grep shutdown
History
List all the history records:
[[email protected]] # 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, the shell 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:
[[Email protected]]# History | 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
Extended Reading
"Linux common Command" series of technical Articles to organize the collection
1 Linux Curl Usage Brief introduction (1)
-path-prune parameter function in 2Linux Find command detailed introduction
3Linux How to use the Locate command to find data to find a 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 in 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 Regular Expression 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 common command summaries for system logs
17Linux How to improve the copy efficiency of large files to save time
What commands does the 18linux system use to view port occupancy?
19Linux Text Search tool grep use detailed
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 directory and how to ignore multiple directories
25centos User-related commands
26 Troubleshooting long idle hours after SSH login disconnect
27Apache, PHP hidden version information
14 useful examples of sort commands in 28Linux (i)
Example of a 2,914 Linux grep command
3,011 Amazing Linux terminal commands
31linux, Unix quick way to empty files
32Centos view real-time traffic command for NIC
335 Classic Interesting Linux command-line tricks
How to use 34Linux Ctrl + Z
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
38Linux, utility commands for creating chat servers, removing redundant packages
39 detailed instructions on how to use md5sum commands in Linux systems
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Organize Linux to view system logs for some common commands