Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Count the first 20 IP addresses of port 22 of the currently connected server

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Netstat-nat | grep "192.168.100.102 awk" | awk'{print $5}'| awk-F':'{print $1}'| sort | uniq-c | sort-nr | head-20

Sort:

Function description: sort the content of the text file, and sort can sort the content of the text file by behavior unit.

Copy the code

Parameters:

-b ignores space characters that begin at the beginning of each line.

-c check whether the files have been sorted in order.

When sorting, ignore other characters except alphabetic, numeric and space characters.

When sorting, lowercase letters are treated as uppercase letters.

When sorting, all characters except ASCII characters between 040 and 176are ignored.

-m merges several sorted files.

-M sorts the first three letters according to the abbreviation of the month.

-n is sorted by the size of the number.

-o saves the sorted results to the specified file.

-r is sorted in reverse order.

-t specifies the field delimiter used for sorting.

+-sorts by the specified field, ranging from the start field to the previous field of the end field.

-- help displays help.

-- version displays version information

Uniq:

Usage: uniq [option]. [file]

Filter adjacent matching lines from the input file or standard input and write to the output file or standard output.

When no options are attached, the matching rows will be merged at the first occurrence.

The parameters that must be used for long options are also required for short options.

-c,-- count prefixes each line with a prefix number indicating the number of occurrences of the corresponding line header

-d,-- repeated outputs only duplicate lines

-D,-- all-repeated [= delimit-method shows all duplicate lines

Delimit-method= {none (default), prepend,separate}

The limit of empty behavior

-f,-- skip the first N columns when skip-fields=N comparison

-I,-- ignore-case is not case-sensitive when comparing

-s,-- skip the first N characters in skip-chars=N comparison

-u,-- unique displays only unique lines

-z,-- zero-terminated uses'\ 0' as the line Terminator instead of a new line feed

-w,-- check-chars=N does not compare the content after the nth character of each line

-- help displays this help and exits

-- version displays version information and exits

If the field is a blank character (usually includes spaces and tabs), and then a non-empty character, the empty character before the character in the field will be skipped.

Tip: uniq does not check for duplicate rows unless they are adjacent rows.

If you want to sort the input first, use "sort-u" without uniq.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report