File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -529,6 +529,16 @@ $ ls -h [DIRECTORY]
529529 $ tree [DIRECTORY]
530530 ```
531531
532+ !!! tip "eza"
533+
534+ [eza](https://github.com/eza-community/eza) 是一个 `ls` 的替代品,输出更加好看。可以使用如下命令安装:
535+
536+ ```console
537+ $ sudo apt install eza
538+ ```
539+
540+ 其使用方法和 `ls` 基本相同,例如显示详细信息则使用 `eza -l`。
541+
532542### 查看文件内容 {#view}
533543
534544#### cat {#cat}
@@ -556,6 +566,20 @@ $ cat [OPTION] FILE
556566
557567 当然和猫咪没有关系,cat 这里是 con**cat**enate(连接)的缩写,因为 cat 工具实际的功能是连接多个文件,然后输出。但是当只有一个文件的时候,cat 就会直接输出这个文件,所以 cat 最常见的用途就是输出单个文件。
558568
569+ !!! tip "bat"
570+
571+ [bat](https://github.com/sharkdp/bat) 是一个 `cat` 的替代品,输出支持语法高亮和分页。可以使用如下命令安装:
572+
573+ ```console
574+ $ sudo apt install bat
575+ ```
576+
577+ 例如,输出 sol1.c 文件的内容(支持 C 语言语法高亮):
578+
579+ ```console
580+ $ bat sol1.c
581+ ```
582+
559583#### less {#less}
560584
561585less 和 cat 的区别在于,cat 会一次性打印全部内容到终端中并退出,而 less 一次只显示一页,且支持向前/后滚动、搜索等功能。如果要在一个大文件中(例如 man page)查找一部分内容,less 通常要比 cat 方便得多。
You can’t perform that action at this time.
0 commit comments