Shell Commands
[TOC]
合并行
$ cat test.txt
1 2
3 4
5 6
7 8奇偶行合并
$ sed "N;s/\n/ /" test.txt
1 2 3 4
5 6 7 8指定行合并
第三,四行合并
$ sed "3N;s/\n/ /" test.txt
1 2
3 4
5 6 7 8所有行合并
:a:label
$!:尾行不执行
ba:无条件跳转到 label a
删除行
删除含有 3 的行
删除含有 3,4 的行
插入行
插入第一行
追加尾行
跳过行
跳过第三行(2+1)
重复行
只保留第一次出现的行
按第 1 列
按第 2 列
显示行数
删除 RC 状态的包(Debian)
r: the package is marked for removal.
c: the configuration files are currently present in the system.
显示根的磁盘信息
CPU 最近 5 次 id 信息
显示特定 app 内存
显示 TCP 各个状态连接数
Last updated
Was this helpful?