GNU核心工具#
GNU Core Utilities(GNU核心工具)包含一系列基础文件和工具,包括shell和文本操作工具。这些是GNU系统的最核心工具。
输出文件内容#
- cat: 输出文件内容,默认输出到当前屏幕
- tac: 倒序输出文件内容
- nl: 输出文件内容并显示行号,等同于
cat -n - od: 以八进制方式输出文件内容
- base32: 32位编码解码文件
- base64: 64位编码解码文件
- basenc: 多种格式编码解码文件
nl命令将文件输出时附带显示所有行号或部分行号,默认使用效果等同于cat -n
$ nl push.sh
1 rm -rf resources/ public/ .hugo_build.lock
2 git add .
3 git commit -m "update"
4 git push
5 sleep 3s
6 echo "Done!"
7 sleep 3s-n format选项用来设置编号样式,有以下三种
$ nl -n ln push.sh
1 rm -rf resources/ public/ .hugo_build.lock
2
3
4 git add .
5 git commit -m "update"
6 git push
7 sleep 3s
8 echo "Done!"
9 sleep 3s
$ nl -n rn push.sh
1 rm -rf resources/ public/ .hugo_build.lock
2
3
4 git add .
5 git commit -m "update"
6 git push
7 sleep 3s
8 echo "Done!"
9 sleep 3s
$ nl -n rz push.sh
000001 rm -rf resources/ public/ .hugo_build.lock
000002
000003
000004 git add .
000005 git commit -m "update"
000006 git push
000007 sleep 3s
000008 echo "Done!"
000009 sleep 3s-s string选项用来设置编号和文本内容之间的分隔符,默认为TAB