Discover linux log all commands to syslog, include the articles, news, trends, analysis and practical advice about linux log all commands to syslog on alibabacloud.com
Execute shell commands in the program to automatically obtain all the online IP addresses and open ports in the LAN (Linux), shelllinuxPreface
The question is a bit long. It is actually the following: first, let the Shell command be executed in the program, and then pass the execution result to the variable, so that subsequent transactions can be processed, the s
In a linux system, you can view the commands of all services in a linux system, you can choose to start or stop services, such as ftp, ssh, and telnet, but I forgot what the command is called ,... in a linux system, you can view the comm
People who have used the Linux system know that the Linux system view user is not the same as Windows, the right mouse button to see my Computer properties, and then look at the computer users and groups. So what do you do when looking at all the users in the Linux operating system? With the command. In fact, it is eas
per dayCat log_file |grep ' 12/nov/2011 ' | grep "******.jsp" |wc|awk ' {print $} ' |uniq26. How many independent IPs have access to the siteCat log_file |grep ' 12/aug/2011 ' |grep "******" |wc|awk ' {print $} ' |uniqView the number of IP connections in the day by log, filter duplicateCat Log_file | grep "20/oct/2008" | awk ' {print $} ' | Sort | uniq-c | Sort–nr27. Sniff 80-port access with tcpdump to see who is the tallestTcpdump-i ETH0-TNN DST Po
1, causesRecently some files on the Linux server were tampered with, want to trace the records have not been found, so you have to think of a way to record all the user's Operation records.Generally, we usually use history to record, but there is a flaw in the historical is the default is 1000 rows, of course, you can also vim/etc/profile 1000 to 1000000 lines, but this is a relatively general practice, No
1. Check the first n rows of the log: Cat file name | Number of Head-nDemoCat Test.log | Head-n 200 # View Test.log Top 200 lines2. Look at the end of the log n rows : Cat file name | Number of Tail-nDemoCat Test.log | Tail-n 200 # View Test.log Countdown 200 Lines3, according to the keywords to view the log and return the keyword line : method One: cat path/f
This script is found on the internet, a little bit of modification, can be implemented under Linux all users, whether remote or local landing, all operations on this machine will be recorded, and generate a "user/ip/time" files stored in the specified location, Convenient for the administrator to see what different users are doing on the server!
At present, this
1. Cat command:function:1) Displays the entire file.Example: $ cat FileName2) Connect the file string to the basic output, such as merging several files into one file or output to the screen.Example: $ cat file1 file2 > fileDescription: Connect the file string to the basic output (screen or add > FileName to another file)Detailed Cat parameters:-N or –number the number of rows for all outputs starting from 1-B or –number-nonblank and-n similar, except
The log analysis commands commonly used under Linux are described in this article under the command line or script that is commonly used in Linux for parsing logs, with the need for a friend to refer to.Access.log log content such as the following:211.123.23.133–-[10/dec/201
Tail-f Test.logYou will see that the screen is constantly being printed out. This time interrupts the first process ctrl-c,How Linux displays a few lines of a file (in the middle of a few lines)Starting at line No. 3000, displays 1000 rows. The 3000~3999 line is displayedCat FileName | Tail-n +3000 | Head-n 1000Display 1000 rows to 3000 rowsCat filename| Head-n 3000 | Tail-n +1000* Note the order of the two methodsDecomposition:Tail-n 1000: Show last
1. View Log common commands tail:-n is the display line number, equivalent to the NL command; examples are as follows:tail-100f Test.log Real-time monitoring of 100 rows of logsTail-n test.log query log at the end of the last 10 lines;Tail-n +10 test.log Query all logs after 10 lines;HeadContrary to tail, tail is the n
The common log analysis commands in linux are as follows. log content: 211.123.23.20.--[10/Dec/2010: 09: 31: 17 + 0800] "GET/query/trendxml/district/todayreturn/month/2009-12-14/2010-12-09/haizhu_tianhe.xml HTTP/1.1" 200 1933 "-" "Mozilla/ 5.0 (Windows; u; Windows NT 5.1; zh-CN; rv: 1.9.2.8) Gecko/20100722 Firefox/3.6.
| uniq-c | Sort-k 1-r | Head-10View the most time-consuming pagesCat Access.log | Sort-k 2-n-r | Head 1014. Big Kill deviceSedSed ' s/xxx/hello ' access.log replace xxx with Hello output (s is the text substitution command)Sed-n ' 2,6p ' access.log only outputs the line between 2nd and 6th (-n means the specified row is output)Sed '/qq/d ' access.log delete line containing QQ (d is text Delete command)Sed ' = ' access.log display file line numberSed-e ' I\head ' Access.log inserts the head stri
In a linux system, you can view the commands of all services in a linux system, you can choose to start or stop services, such as ftp, ssh, and telnet, but I forgot what the command is called. Remember that it was sysconfig, however, this command is not available in the system. This command is "chkconfig -- list". The
] [' Who Am I 2>/dev/null\
| awk ' {print $NF} ' |sed-e ' s/[()]//g '] '
#登录时清空当前缓存 echo "" > Bash_history
Step two: Different users are set up separately
The code is as follows:
# Source/etc/profile
# Vi/home/user1/.bash_logout
#当用户退出登录时会执行此脚本
tmpfile= "/tmp/' WhoAmI ' _history.tmp"
#把格式化的history记录到文件里
History > $tmpfile
#读取文件, a line to send the contents of the file to the SYSLOGD.
#不要试图用 "History | Logger "or" logger-f $tmpfile "instead of the following co
Examples are as follows:The third command is to replace all "Arm-none-linux-gnueabi" in the code in the current directory with "Arm-linux"Sed-i ' s/arm-none-linux-gnueabi-g++/arm-linux-g++\-o2\-i\$\ (inc\) \-i\$\ (incsys\) \-static/g ' grep arm-none-
People who have used the Linux system know that the Linux system view user is not the same as Windows, the right mouse button to see my Computer properties, and then look at the computer users and groups. So what do you do when looking at all the users in the Linux operating system? With the command. In fact, it is eas
matching rows-I ignores case-Q Silence-a n Displays the keyword and its next n rows-B n Displays the keyword and its top n rows-c n Displays the keyword and its top and bottom n rows-E: Implementing a logical or relationship between multiple options-W: Matches entire word-E or egrep using the extended regular-F or Fgrep do not use regularSed-I change the original file-i.bak back up the original file to. bak before you change it-N Do not print-E Multi-mode-f Sed.txt Specifying scripts files-R Sp
View all CPU load commands in LINUX $ vmstatprocs ----------- memory ---------- --- swap -- ----- io ---- system -- ----- cpu ------ r B swpd free buff cache si so bi bo in cs us sy id wa st 1 4 329796 26040 4528 3379824 1 1 50 160 36 17 2 10 85 3 0 procsr column indicates the number of processes running and waiting for the cpu time slice, if the cpu usage exceed
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.