前言
博主github
博主个人博客http://blog.healerjean.com
1、帮助指令
1.1、–-help
:显示shell内部的命令帮助信息
--help
命令用于显示shell内部的帮助信息。help命令只能显示shell内部的命令帮助信息。而对于外部命令的帮助信息只能使用man或者info命令查看。
grep --help
root@healerjean:~# grep --help
Usage: grep [OPTION]... PATTERN [FILE]...
Search for PATTERN in each FILE or standard input.
PATTERN is, by default, a basic regular expression (BRE).
Example: grep -i 'hello world' menu.h main.c
Regexp selection and interpretation:
-E, --extended-regexp PATTERN is an extended regular expression (ERE)
-F, --fixed-strings PATTERN is a set of newline-separated strings
-G, --basic-regexp PATTERN is a basic regular expression (BRE)
-P, --perl-regexp PATTERN is a Perl regular expression
-e, --regexp=PATTERN use PATTERN for matching
-f, --file=FILE obtain PATTERN from FILE
-i, --ignore-case ignore case distinctions
-w, --word-regexp force PATTERN to match only whole words
-x, --line-regexp force PATTERN to match only whole lines
-z, --null-data a data line ends in 0 byte, not newline
Miscellaneous:
-s, --no-messages suppress error messages
-v, --invert-match select non-matching lines
-V, --version display version information and exit
--help display this help text and exit
Output control:
-m, --max-count=NUM stop after NUM matches
-b, --byte-offset print the byte offset with output lines
-n, --line-number print line number with output lines
--line-buffered flush output on every line
-H, --with-filename print the file name for each match
-h, --no-filename suppress the file name prefix on output
--label=LABEL use LABEL as the standard input file name prefix
-o, --only-matching show only the part of a line matching PATTERN
-q, --quiet, --silent suppress all normal output
--binary-files=TYPE assume that binary files are TYPE;
TYPE is 'binary', 'text', or 'without-match'
-a, --text equivalent to --binary-files=text
-I equivalent to --binary-files=without-match
-d, --directories=ACTION how to handle directories;
ACTION is 'read', 'recurse', or 'skip'
-D, --devices=ACTION how to handle devices, FIFOs and sockets;
ACTION is 'read' or 'skip'
-r, --recursive like --directories=recurse
-R, --dereference-recursive likewise, but follow all symlinks
--include=FILE_PATTERN search only files that match FILE_PATTERN
--exclude=FILE_PATTERN skip files and directories matching FILE_PATTERN
--exclude-from=FILE skip files matching any file pattern from FILE
--exclude-dir=PATTERN directories that match PATTERN will be skipped.
-L, --files-without-match print only names of FILEs containing no match
-l, --files-with-matches print only names of FILEs containing matches
-c, --count print only a count of matching lines per FILE
-T, --initial-tab make tabs line up (if needed)
-Z, --null print 0 byte after FILE name
Context control:
-B, --before-context=NUM print NUM lines of leading context
-A, --after-context=NUM print NUM lines of trailing context
-C, --context=NUM print NUM lines of output context
-NUM same as --context=NUM
--color[=WHEN],
--colour[=WHEN] use markers to highlight the matching strings;
WHEN is 'always', 'never', or 'auto'
-U, --binary do not strip CR characters at EOL (MSDOS/Windows)
-u, --unix-byte-offsets report offsets as if CRs were not there
(MSDOS/Windows)
'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.
Direct invocation as either 'egrep' or 'fgrep' is deprecated.
When FILE is -, read standard input. With no FILE, read . if a command-line
-r is given, - otherwise. If fewer than two FILEs are given, assume -h.
Exit status is 0 if any line is selected, 1 otherwise;
if any error occurs and -q is not given, the exit status is 2.
Report bugs to: bug-grep@gnu.org
GNU grep home page: <http://www.gnu.org/software/grep/>
General help using GNU software: <http://www.gnu.org/gethelp/>
root@healerjean:~#
1.2、man
:查看命令帮助(手册页丰富)
man
命令,manual的简写,查看Linux中的指令帮助、配置文件帮助和编程帮助等信息。man是在程序安装的时候安装的帮助文档可以在系统的目录下找到,如果软件有配套的页面,就可以使用man来查找。如果删除了某个手册页文件时man就无法显示了。man命令显示的帮助信息要更加丰富,它比命令的help选项多了命令的用法示例、命令的描述等内容
man grep
1.2.1、浏览技巧
1.2.1.1、滚动一行:Enter键
1.2.1.2、翻一页:空格键
1.2.1.3、查询某个内容: 例如: /a ,查询a这个单词的位置
1.2.1.4、退出 :q
GREP(1) General Commands Manual GREP(1)
NAME
grep, egrep, fgrep, rgrep - print lines matching a pattern
SYNOPSIS
grep [OPTIONS] PATTERN [FILE...]
grep [OPTIONS] [-e PATTERN]... [-f FILE]... [FILE...]
DESCRIPTION
grep searches the named input FILEs for lines containing a match to the given PATTERN. If no files are specified, or if the file “-” is given, grep searches standard input. By
default, grep prints the matching lines.
In addition, the variant programs egrep, fgrep and rgrep are the same as grep -E, grep -F, and grep -r, respectively. These variants are deprecated, but are provided for backward
compatibility.
OPTIONS
Generic Program Information
--help Output a usage message and exit.
-V, --version
Output the version number of grep and exit.
Matcher Selection
-E, --extended-regexp
Interpret PATTERN as an extended regular expression (ERE, see below).
-F, --fixed-strings
Interpret PATTERN as a list of fixed strings (instead of regular expressions), separated by newlines, any of which is to be matched.
-G, --basic-regexp
Interpret PATTERN as a basic regular expression (BRE, see below). This is the default.
-P, --perl-regexp
Interpret the pattern as a Perl-compatible regular expression (PCRE). This is highly experimental and grep -P may warn of unimplemented features.
Matching Control
-e PATTERN, --regexp=PATTERN
Use PATTERN as the pattern. If this option is used multiple times or is combined with the -f (--file) option, search for all patterns given. This option can be used to
protect a pattern beginning with “-”.
-f FILE, --file=FILE
Obtain patterns from FILE, one per line. If this option is used multiple times or is combined with the -e (--regexp) option, search for all patterns given. The empty file
contains zero patterns, and therefore matches nothing.
-i, --ignore-case
Ignore case distinctions in both the PATTERN and the input files.
-v, --invert-match
Invert the sense of matching, to select non-matching lines.
-w, --word-regexp
Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a
non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word-constituent characters are
letters, digits, and the underscore.
-x, --line-regexp
Select only those matches that exactly match the whole line. For a regular expression pattern, this is like parenthesizing the pattern and then surrounding it with ^ and
$.
-y Obsolete synonym for -i.
General Output Control
-c, --count
Suppress normal output; instead print a count of matching lines for each input file. With the -v, --invert-match option (see below), count non-matching lines.
--color[=WHEN], --colour[=WHEN]
Surround the matched (non-empty) strings, matching lines, context lines, file names, line numbers, byte offsets, and separators (for fields and groups of context lines)
with escape sequences to display them in color on the terminal. The colors are defined by the environment variable GREP_COLORS. The deprecated environment variable
GREP_COLOR is still supported, but its setting does not have priority. WHEN is never, always, or auto.
-L, --files-without-match
Suppress normal output; instead print the name of each input file from which no output would normally have been printed. The scanning will stop on the first match.
-l, --files-with-matches
Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match.
-m NUM, --max-count=NUM
Stop reading a file after NUM matching lines. If the input is standard input from a regular file, and NUM matching lines are output, grep ensures that the standard input
is positioned to just after the last matching line before exiting, regardless of the presence of trailing context lines. This enables a calling process to resume a search.
When grep stops after NUM matching lines, it outputs any trailing context lines. When the -c or --count option is also used, grep does not output a count greater than NUM.
When the -v or --invert-match option is also used, grep stops after outputting NUM non-matching lines.
-o, --only-matching
Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.
-q, --quiet, --silent
Quiet; do not write anything to standard output. Exit immediately with zero status if any match is found, even if an error was detected. Also see the -s or --no-messages
option.
-s, --no-messages
Suppress error messages about nonexistent or unreadable files.
Output Line Prefix Control
-b, --byte-offset
Print the 0-based byte offset within the input file before each line of output. If -o (--only-matching) is specified, print the offset of the matching part itself.
-H, --with-filename
Print the file name for each match. This is the default when there is more than one file to search.
-h, --no-filename
Suppress the prefixing of file names on output. This is the default when there is only one file (or only standard input) to search.
--label=LABEL
Display input actually coming from standard input as input coming from file LABEL. This is especially useful when implementing tools like zgrep, e.g., gzip -cd foo.gz |
grep --label=foo -H something. See also the -H option.
-n, --line-number
Prefix each line of output with the 1-based line number within its input file.
-T, --initial-tab
Make sure that the first character of actual line content lies on a tab stop, so that the alignment of tabs looks normal. This is useful with options that prefix their
output to the actual content: -H,-n, and -b. In order to improve the probability that lines from a single file will all start at the same column, this also causes the line
number and byte offset (if present) to be printed in a minimum size field width.
-u, --unix-byte-offsets
Report Unix-style byte offsets. This switch causes grep to report byte offsets as if the file were a Unix-style text file, i.e., with CR characters stripped off. This
will produce results identical to running grep on a Unix machine. This option has no effect unless -b option is also used; it has no effect on platforms other than MS-DOS
and MS-Windows.
-Z, --null
Output a zero byte (the ASCII NUL character) instead of the character that normally follows a file name. For example, grep -lZ outputs a zero byte after each file name
instead of the usual newline. This option makes the output unambiguous, even in the presence of file names containing unusual characters like newlines. This option can be
used with commands like find -print0, perl -0, sort -z, and xargs -0 to process arbitrary file names, even those that contain newline characters.
Context Line Control
-A NUM, --after-context=NUM
Print NUM lines of trailing context after matching lines. Places a line containing a group separator (--) between contiguous groups of matches. With the -o or
--only-matching option, this has no effect and a warning is given.
-B NUM, --before-context=NUM
Print NUM lines of leading context before matching lines. Places a line containing a group separator (--) between contiguous groups of matches. With the -o or
--only-matching option, this has no effect and a warning is given.
-C NUM, -NUM, --context=NUM
Print NUM lines of output context. Places a line containing a group separator (--) between contiguous groups of matches. With the -o or --only-matching option, this has
no effect and a warning is given.
File and Directory Selection
-a, --text
Process a binary file as if it were text; this is equivalent to the --binary-files=text option.
--binary-files=TYPE
If the first few bytes of a file indicate that the file contains binary data, assume that the file is of type TYPE. By default, TYPE is binary, and grep normally outputs
either a one-line message saying that a binary file matches, or no message if there is no match. If TYPE is without-match, grep assumes that a binary file does not match;
this is equivalent to the -I option. If TYPE is text, grep processes a binary file as if it were text; this is equivalent to the -a option. When processing binary data,
grep may treat non-text bytes as line terminators; for example, the pattern '.' (period) might not match a null byte, as the null byte might be treated as a line
terminator. Warning: grep --binary-files=text might output binary garbage, which can have nasty side effects if the output is a terminal and if the terminal driver
interprets some of it as commands.
-D ACTION, --devices=ACTION
If an input file is a device, FIFO or socket, use ACTION to process it. By default, ACTION is read, which means that devices are read just as if they were ordinary files.
If ACTION is skip, devices are silently skipped.
-d ACTION, --directories=ACTION
If an input file is a directory, use ACTION to process it. By default, ACTION is read, i.e., read directories just as if they were ordinary files. If ACTION is skip,
silently skip directories. If ACTION is recurse, read all files under each directory, recursively, following symbolic links only if they are on the command line. This is
equivalent to the -r option.
--exclude=GLOB
Skip files whose base name matches GLOB (using wildcard matching). A file-name glob can use *, ?, and [...] as wildcards, and \ to quote a wildcard or backslash character
literally.
--exclude-from=FILE
1.3、info:比man
指令的更详细内容
info
指令是man
更详细内容。但man 使用起来要方便的多。一个man 只有一页,通常man中若包含的信息概要在info中也有时,会有提示:“请参考info页更详细内容”
2、passwd
:用于修改密码
用于修改密码,先输入旧密码,再输入新密码
3、who
:查看当前用户登录到系统的用户信息
查看当前用户登录到系统的用户信息
root@healerjean:~# who
root pts/0 2020-01-15 12:26 (106.37.187.184)
3、uname
:显示当前正在使用的Linux的系统信息
显示当前正在使用的Linux的系统信息
命令 | 说明 |
---|---|
uname -a |
all:显示全部的信息 |
uname -s |
sysname : 显示操作系统名称(Linux) |
uname -n |
nodename:显示在网络上的主机名(healerjean) |
uname -r |
release:操作系统的发行编号(4.4.0-117-generic) |
uname -m |
machine:显示电脑类型(x86_64) |
3.1、uname -a
:显示全部的信息
root@healerjean:~# uname -a
Linux healerjean 4.4.0-117-generic #141-Ubuntu SMP Tue Mar 13 11:58:07 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
3.2、其他命令
root@healerjean:~# uname -s
Linux
root@healerjean:~# uname -n
healerjean
root@healerjean:~# uname -r
4.4.0-117-generic
root@healerjean:~# uname -m
x86_64
root@healerjean:~#
4、date :显示或设置系统时间
显示或设置系统时间
root@healerjean:~# date
Wed Jan 15 14:04:18 CST 2020
5、cal:输出日历信息
输出日历信息
root@healerjean:~# cal
January 2020
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 .15. 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
月份 | 英文 |
---|---|
一月 | january |
二月 | february |
三月 | march |
四月 | april |
五月 | may |
六月 | june |
七月 | july |
八月 | august |
九月 | september |
十月 | october |
十一月 | november |
十二月 | december |
5、su:切换登陆用户
切换用户使用的系统,需要知道用户名和密码。
返回使用命令:exit
6、netstat
:查看端口状态
利用
netstat
指令可让你得知整个Linux系统的网络情况。
命令 | 说明 |
---|---|
netstat -a |
列出所有连接 |
netstat -t |
列出 TCP 协议的连接: |
netstat -u |
列出 UDP 协议的连接 |
netstat -n |
禁止用反向域名解析,加快查询速度,具体看下面 |
netstat -l |
只列出监听中的连接 |
netstat -p |
获取进程名、进程号以及用户 ID |
6.1、使用说明
6.1.1、Status
Status | 说明 |
---|---|
LISTEN | 侦听来自远方的TCP端口的连接请求 |
SYN-SENT | 在发送连接请求后等待匹配的连接请求(如果有大量这样的状态包,检查是否中招了) |
SYN-RECEIVED | 在收到和发送一个连接请求后等待对方对连接请求的确认(如有大量此状态,估计被flood攻击了) |
ESTABLISHED | 代表一个打开的连接 |
FIN-WAIT-1 | 等待远程TCP连接中断请求,或先前的连接中断请求的确认 |
FIN-WAIT-2 | 从远程TCP等待连接中断请求 |
CLOSE-WAIT | 等待从本地用户发来的连接中断请求 |
CLOSING | 等待远程TCP对连接中断的确认 |
LAST-ACK | 等待原来的发向远程TCP的连接中断请求的确认(不是什么好东西,此项出现,检查是否被攻击) |
TIME-WAIT | 等待足够的时间以确保远程TCP接收到连接中断请求的确认 |
CLOSED | 没有任何连接状态 |
6.2.2、常用组合命令
6.2.2.1、只查询tcp
协议、并显示进程号,禁止域名反向解析,显示状态为LISTEN的端口
netstat -ntpl | grep 8080
6.2.2.2、查询tcp
和udp
协议,并显示进程号,禁用域名反向解析
netstat -anput | grep 8888
6.1、netstat -a
:列出所有连接
列出所有连接
netstat -a
root@healerjean:~# netstat -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 *:https *:* LISTEN
tcp 0 0 *:7777 *:* LISTEN
tcp 0 0 localhost:9000 *:* LISTEN
tcp 0 0 *:6666 *:* LISTEN
tcp 0 0 localhost:6379 *:* LISTEN
tcp 0 0 *:9999 *:* LISTEN
tcp 0 0 *:http *:* LISTEN
tcp 0 0 *:tproxy *:* LISTEN
tcp 0 0 *:8082 *:* LISTEN
tcp 0 0 healerjean:45088 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45080 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45102 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45016 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:42858 100.100.30.25:http ESTABLISHED
tcp 0 0 healerjean:44990 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45074 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45066 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45032 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45082 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45056 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45036 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45062 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:44998 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45026 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:44996 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45046 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45084 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45052 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45000 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45068 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45072 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45044 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45086 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45028 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45020 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45034 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45064 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45030 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45008 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45076 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45058 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45098 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45024 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45022 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45014 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:44994 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45096 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45012 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45054 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45078 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45004 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45070 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45100 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:ssh 106.37.187.184:4775 ESTABLISHED
tcp 0 0 healerjean:45090 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:44992 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45048 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45094 100.100.100.200:http TIME_WAIT
tcp 0 8400 healerjean:ssh 106.37.187.184:18710 ESTABLISHED
tcp 0 0 healerjean:45006 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45002 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45018 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45050 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:45042 100.100.100.200:http TIME_WAIT
tcp6 0 0 [::]:mysql [::]:* LISTEN
udp 0 0 *:bootpc *:*
udp 0 0 healerjean:ntp *:*
udp 0 0 localhost:ntp *:*
udp 0 0 *:ntp *:*
udp6 0 0 [::]:ntp [::]:*
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ] DGRAM 2328429 /run/user/0/systemd/notify
unix 2 [ ACC ] STREAM LISTENING 2328430 /run/user/0/systemd/private
unix 2 [ ACC ] SEQPACKET LISTENING 9292 /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 11260 /var/run/dbus/system_bus_socket
unix 2 [ ACC ] STREAM LISTENING 10224 /run/uuidd/request
unix 3 [ ] DGRAM 9051 /run/systemd/notify
unix 2 [ ACC ] STREAM LISTENING 685879 /run/systemd/private
unix 2 [ ACC ] STREAM LISTENING 9289 /run/systemd/fsck.progress
unix 2 [ ] DGRAM 9290 /run/systemd/journal/syslog
unix 10 [ ] DGRAM 9291 /run/systemd/journal/dev-log
unix 2 [ ACC ] STREAM LISTENING 9297 /run/systemd/journal/stdout
unix 6 [ ] DGRAM 9298 /run/systemd/journal/socket
unix 2 [ ACC ] STREAM LISTENING 230958689 /var/run/mysqld/mysqld.sock
unix 2 [ ACC ] STREAM LISTENING 400046466 /usr/local/aegis/Aegis-<Guid(5A2C30A2-A87D-490A-9281-6765EDAD7CBA)>
unix 2 [ ACC ] STREAM LISTENING 400046465 /tmp/Aegis-<Guid(5A2C30A2-A87D-490A-9281-6765EDAD7CBA)>
unix 2 [ ] DGRAM 2330332
unix 3 [ ] STREAM CONNECTED 735406
unix 3 [ ] STREAM CONNECTED 2330326
unix 3 [ ] STREAM CONNECTED 3046640
unix 3 [ ] STREAM CONNECTED 2328411 /run/systemd/journal/stdout
unix 3 [ ] STREAM CONNECTED 538788633
unix 3 [ ] STREAM CONNECTED 735407 /run/systemd/journal/stdout
unix 3 [ ] STREAM CONNECTED 3046639
unix 3 [ ] STREAM CONNECTED 11837
unix 3 [ ] STREAM CONNECTED 12567 /run/systemd/journal/stdout
unix 2 [ ] DGRAM 410089914
unix 2 [ ] DGRAM 2328419
unix 2 [ ] DGRAM 735409
unix 3 [ ] STREAM CONNECTED 11838 /var/run/dbus/system_bus_socket
unix 2 [ ] STREAM CONNECTED 537159779
unix 3 [ ] STREAM CONNECTED 11364
unix 3 [ ] DGRAM 735419
unix 3 [ ] STREAM CONNECTED 11363
unix 2 [ ] DGRAM 11360
unix 3 [ ] DGRAM 735420
unix 3 [ ] STREAM CONNECTED 538788636
unix 3 [ ] STREAM CONNECTED 749487
unix 3 [ ] STREAM CONNECTED 538788634
unix 3 [ ] STREAM CONNECTED 749488 /run/systemd/journal/stdout
unix 3 [ ] STREAM CONNECTED 12622 /run/systemd/journal/stdout
unix 2 [ ] DGRAM 539128832
unix 3 [ ] STREAM CONNECTED 12566
unix 3 [ ] STREAM CONNECTED 11421
unix 3 [ ] STREAM CONNECTED 12701
unix 3 [ ] STREAM CONNECTED 11523
unix 3 [ ] STREAM CONNECTED 12702 /var/run/dbus/system_bus_socket
unix 2 [ ] DGRAM 534823795
unix 2 [ ] DGRAM 11431
unix 3 [ ] STREAM CONNECTED 559897 /run/systemd/journal/stdout
unix 2 [ ] DGRAM 9316
unix 3 [ ] STREAM CONNECTED 11326 /run/systemd/journal/stdout
unix 2 [ ] STREAM CONNECTED 538789484
unix 3 [ ] STREAM CONNECTED 560057 /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 559038
unix 3 [ ] STREAM CONNECTED 560056
unix 3 [ ] STREAM CONNECTED 12648 /run/systemd/journal/stdout
unix 3 [ ] STREAM CONNECTED 685878
unix 2 [ ] DGRAM 538974267
unix 3 [ ] STREAM CONNECTED 538788635
unix 2 [ ] STREAM CONNECTED 537177061
unix 3 [ ] STREAM CONNECTED 11324
unix 2 [ ] DGRAM 2866759
unix 3 [ ] STREAM CONNECTED 686129 /var/run/dbus/system_bus_socket
unix 2 [ ] DGRAM 750451
unix 3 [ ] STREAM CONNECTED 2865786
unix 3 [ ] STREAM CONNECTED 400046463
unix 3 [ ] STREAM CONNECTED 400046464
unix 2 [ ] DGRAM 11976
unix 3 [ ] STREAM CONNECTED 2866737 /run/systemd/journal/stdout
unix 3 [ ] STREAM CONNECTED 752695
unix 3 [ ] STREAM CONNECTED 400046461
unix 3 [ ] STREAM CONNECTED 752698 /run/systemd/journal/stdout
unix 3 [ ] STREAM CONNECTED 400046462
6.2、netstat -t
:列出 TCP 协议的连接
列出 TCP 协议的连接
6.2.1、netstat -t
netstat -t
root@healerjean:~# netstat -t
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 healerjean:49414 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49504 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49458 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:42858 100.100.30.25:http ESTABLISHED
tcp 0 0 healerjean:49478 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49468 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49500 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:6666 li2091-37.members:51004 TIME_WAIT
tcp 0 0 healerjean:49430 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49428 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49442 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49518 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49490 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49470 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49426 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49436 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49476 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49510 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49508 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49516 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49494 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49484 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49498 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49460 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49448 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49416 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49464 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49486 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49488 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49452 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49462 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49446 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49512 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49420 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:ssh 106.37.187.184:4775 ESTABLISHED
tcp 0 0 healerjean:49438 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49466 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49502 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49474 100.100.100.200:http TIME_WAIT
tcp 0 0 healerjean:49444 100.100.100.200:http TIME_WAIT
tcp 0 2352 healerjean:ssh 106.37.187.184:18710 ESTABLISHED
tcp