Common troubleshooting command lines in linux 1. view TCP connection status netstat-nat | awk '{print $6}' | sort | uniq-c | sort-rnnetstat-n | awk '/^ tcp/{++ S [$ NF]}; END {for (a in S) print a, S [a]} 'netstat-n | awk'/^ tcp/{++ state [$ NF]};
[Awk Introduction:]
Awk can obtain part of the content from a text, or typeset the text so that it can be output in a certain format.
[Awk workflow:]
Awk will upload a row of file content to the memory and segment the content in this line
System connection status:1. View TCP connection statusNetstat-nat | awk '{print $6}' | sort | uniq-c | sort-rnNetstat-n | awk '/^ tcp/{++ S [$ NF]}; END {for (a in S) print a, S [a]}' orNetstat-n | awk '/^ tcp/{++ state [$ NF]}; END {for (key in
Vps security settings, server security dog
It is suitable for new users and friends who have access to VPS. It focuses on VPS security.
Prohibit ROOT login to ensure security;
Use DDoS deflate to defend against attacks;
Iftop Linux traffic
''' [Program 24] Question: There is a fractional sequence: 2/1, 3/2, 5/3, 8/5, 13/8... find the sum of the first 20 items of this series. 1. Program Analysis: grasp the variation rules between numerator and denominator. 2. program source code: ''' #
Linux Command awk
Awk is a powerful text analysis tool that reads files row by row. It uses spaces as the default delimiter to segment each line and then analyzes and processes the cut parts.
Awk command format:
Awk [-F |-f |-v] 'in in {} //
Oracle uses shell to test historical data samples
Shell has been used to analyze some data for some time, and the data analysis is based on historical data. Today, I wrote a script to perform a simple analysis of historical data, see how accurate it
Assume that the apache log format is:118.78.199.98--[09/Jan/2010: 00: 59: 59 + 0800] "GET/Public/Css/index.css HTTP/1.1" 304-"http://www.a.cn/common/index.php”" Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; GTB6.3 )"
Problem 1: In
AWK-is a programming language tool used to process text.Original Meaning: Aho, Weinberger, KernighanDefinition: three creators, Aho, Weinberger, and Kernighan
AWK is similar to the shell programming language in many aspects, although AWK has its own
LinuxAWK command usageAwk usage: awk 'pattern' {action }'Variable name meaningNumber of ARGC command line VariablesARGV command line meta ArrayFILENAME current input file nameNumber of records in the current FNR FileThe input field delimiter of FS.
Introduction to linux awk built-in variables awk is an excellent text processing tool and can be said to be a programming language. The following are the built-in variables of awk. 1. built-in variable table attribute description $0 current record
View system connection status in CentOS
1. View TCP connection status
Netstat-nat | awk '{print $6}' | sort | uniq-c | sort-rn
Netstat-n | awk '/^ tcp/{++ S [$ NF]}; END {for (a in S) print a, S [a]}' orNetstat-n | awk '/^ tcp/{++ state [$ NF]}; END
Package com. Java; public class printfangzhen {/*** prints a two-dimensional array of the same length. The natural numbers starting from 1 are arranged in an ascending order by the outermost ring of the square matrix. For example, if n = 4, print: *
Variable name meaningNumber of argc command line VariablesArgv command line meta ArrayFilename current input file nameFNR record number in the current fileThe input field delimiter of FS. The default Delimiter is a space.RS input record
1.1 view the number of Apache connections
Method 1
[Root @ web10 ~] # Netstat-N | awk '/^ TCP/{++ s [$ NF]} end {for (a in S) print a, s [a]}'Last_ack 8Syn_recv 1Established 1747Fin_wait1 12Time_wait 14208
Method 2
Netstat-an | grep estab | awk
#-*-coding:utf-8-*-"" # Python comments begin with #, followed by a comment until the end of the line; multiline comment begins with 3 "end 3" # integers: decimal integers are written as normal; hexadecimal integers are represented by 0x prefixes
0: Basics of Regular Expressions
^ First line ID
$ End or end of an article
. Represents any character
? Indicates the occurrence of a forward character.
* Indicates the occurrence of 0 or multiple prefix characters.
[1-9] indicates a string of 1 to
Where is awk holy?
In short, awk is a programming language tool used to process text. The language of the awk utility is similar to the shell programming language in many ways, although awk has its own syntax. When awk was initially created, it was
1. Retrieve the number of times the shell appears in the/etc/passwd file
Problem: The following is part of a/etc/passwd file. Obtain the shell and count the number of times. Shell refers to the following/bin/bash,/sbin/nologin, for example, the
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.