Linux
01.系统维护
CPU
内存
drop_cache为什么有些不释放
swap交换分区
磁盘
lvm磁盘扩容
文件夹加密ecryptfs-utils
linux挂载ISCSI磁盘
创建lvm
fstab挂载文件系统
systemd.mount
存储故障
曲线为目录配置限额
lvm缩容
进程
如何找到某一个正在运行的进程?
CRIU进程快照
网络
TCP连接的10种状态
Ubuntu禁用ipv6
close_wait数量过多阻塞网络连接
IP地址与二进制转换
支持ACME的DNS服务器PowerDNS
系统
CentOS版本及对应默认内核版本
修改shell语言
系统启动流程
cgroup
CentOS7升级内核并开启BBR
配置内核参数优化linux
更新grub2默认启动的内核
CentOS-SCLo源
修改键盘映射
Debian12升级时内核编译错误
timesync(ntp)
内核
drop_caches
软件
更新openssl
GUI
Gnome Workspace Names
02.系统安全
Auditd审计服务配置
ssh登陆免公钥验证
恶意脚本处置
2023挖矿脚本m0nad
为ssh服务添加多因子认证
03.基本概念
Out Of Memory
70.QEMU
磁盘格式转换
80.LFS
90.常用脚本
使用except修改操作系统密码
init.d脚本模板
shell脚本判断参数数量
安装oh-my-zsh
systemd脚本模板
端口测试
适用于truenas的ipv6阿里云ddns脚本
更新nginx白名单
将文件改名为md5值
djvu转换为pdf并ocr
99.常用命令
man page中命令后的数字释义
tcpdump
nslookup
nc
rsync
awk
sed
echo
rm
tar
chage
auditctl
ausearch
ab
openssl
parted
find
date
firewall-cmd
sort
vmstat
nice-调整进程的优先级
top
taskset-进程绑定CPU核心
iptables
iostat
sysctl
tr
rpmbuild
转载nginx.spec含说明
安装使用rpmbuild
unpacked files found
grep
vimtutor
tlinux - tos
snmpwalk
chattr
本文档使用 MrDoc 发布
-
+
首页
grep
# grep ## 使用帮助 ```shell 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)/posix扩展正则表达式,实际并非BRE的扩展不完全兼容 -F, --fixed-strings PATTERN is a set of newline-separated fixed strings -G, --basic-regexp PATTERN is a basic regular expression (BRE)/posix标准正则表达式 -P, --perl-regexp PATTERN is a Perl regular expression/比较强大的perl正则表达式 -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 --group-separator=SEP use SEP as a group separator --no-group-separator use empty string as a group separator --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/> ``` ## 示例 ### 输出文件中的IP地址 ``` masscan -p22 10.20.0.0/24 -oX ip.xml grep -ioP '((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}' ip.xml ```
zhangky
2022年2月16日 14:31
分享文档
收藏文档
上一篇
下一篇
微信扫一扫
复制链接
手机扫一扫进行分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码