Skip to content

Commit bb7e5a4

Browse files
committed
Ch03: Use fence title format
1 parent 6ce297a commit bb7e5a4

File tree

1 file changed

+75
-116
lines changed

1 file changed

+75
-116
lines changed

docs/Ch03/index.md

Lines changed: 75 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -503,17 +503,13 @@ $ ls -h [DIRECTORY]
503503

504504
!!! example "ls 示例"
505505

506-
* 以列表的形式显示当前目录下的所有文件(包括隐藏文件)
507-
508-
```console
509-
$ ls -la
510-
```
511-
512-
* 以人类可读的方式显示当前目录下的所有文件(包括隐藏文件)的详细信息
506+
```console title="以列表的形式显示当前目录下的所有文件(包括隐藏文件)"
507+
$ ls -la
508+
```
513509

514-
```console
515-
$ ls -lha
516-
```
510+
```console title="以人类可读的方式显示当前目录下的所有文件(包括隐藏文件)的详细信息"
511+
$ ls -lha
512+
```
517513

518514
!!! tip "tree"
519515

@@ -550,17 +546,13 @@ $ cat [OPTION] FILE
550546

551547
!!! example "输出示例"
552548

553-
* 输出 file.txt 的全部内容
554-
555-
```console
556-
$ cat file.txt
557-
```
558-
559-
* 查看 file1.txt 与 file2.txt 连接后的内容
549+
```console title="输出 file.txt 的全部内容"
550+
$ cat file.txt
551+
```
560552

561-
```console
562-
$ cat file1.txt file2.txt
563-
```
553+
```console title="查看 file1.txt 与 file2.txt 连接后的内容"
554+
$ cat file1.txt file2.txt
555+
```
564556

565557
!!! note "为什么名字叫 cat?"
566558

@@ -642,18 +634,15 @@ $ cp [OPTION] SOURCE... DIRECTORY
642634

643635
!!! example "复制示例"
644636

645-
* 将 `file1.txt` 复制一份到同目录,命名为 `file2.txt`
646-
```console
637+
```console title="将 file1.txt 复制一份到同目录,命名为 file2.txt"
647638
$ cp file1.txt file2.txt
648639
```
649640

650-
* 将 `file1.txt`、`file2.txt` 文件复制到同目录下的 `file` 目录中
651-
```console
641+
```console title="将 file1.txt、file2.txt 文件复制到同目录下的 file 目录中"
652642
$ cp file1.txt file2.txt ./file/
653643
```
654644

655-
* 将 `dir1` 文件夹及其所有子文件复制到同目录下的 `test` 文件夹中
656-
```console
645+
```console title="将 dir1 文件夹及其所有子文件复制到同目录下的 test 文件夹中"
657646
$ cp -r dir1 ./test/
658647
```
659648

@@ -718,31 +707,25 @@ $ rm [OPTION] FILE...
718707

719708
常用的选项:
720709

721-
| 选项 | 含义 |
722-
| ------------------------- | ---------------------------------- |
723-
| `-f`, `--force` | 无视不存在或者没有权限的文件和参数 |
724-
| `-r`, `-R`, `--recursive` | 递归删除目录及其子文件 |
725-
| `-d`, `--dir` | 删除空目录 |
710+
| 选项 | 含义 |
711+
| ------------------------- | -------------------------------------------------------------------- |
712+
| `-f`, `--force` | 无视不存在或者有写保护的文件,只要对包含它的文件夹本身有权限即可删除 |
713+
| `-r`, `-R`, `--recursive` | 递归删除目录及其子文件 |
714+
| `-d`, `--dir` | 删除空目录 |
726715

727716
!!! example "删除示例"
728717

729-
* 删除 `file1.txt` 文件:
730-
731-
```console
732-
$ rm file1.txt
733-
```
734-
735-
* 删除 `test` 目录及其下的所有文件:
736-
737-
```console
738-
$ rm -r test/
739-
```
718+
```console title="删除 file1.txt 文件"
719+
$ rm file1.txt
720+
```
740721

741-
* 删除 `test1/`、`test2/`、`file1.txt` 这些文件、目录。其中,这些文件或者目录可能不存在、写保护或者没有权限读写:
722+
```console title="删除 test 目录及其下的所有文件"
723+
$ rm -r test/
724+
```
742725

743-
```console
744-
$ rm -rf test1/ test2/ file1.txt
745-
```
726+
```console title="尝试强制删除 test1/、test2/、file1.txt 文件和目录。这些文件或者目录可能不存在、有写保护或者没有权限读写"
727+
$ rm -rf test1/ test2/ file1.txt
728+
```
746729

747730
!!! warning "注意目录拼写"
748731

@@ -768,17 +751,13 @@ $ mkdir [OPTION] DIR_NAME...
768751

769752
!!! example "创建目录示例"
770753

771-
* 创建两个目录,名字分别为 `test1`、`test2`:
772-
773-
```console
774-
$ mkdir test1 test2
775-
```
776-
777-
* 创建路径 `test1/test2/test3/`:
754+
```console title="创建两个目录,名字分别为 test1、test2"
755+
$ mkdir test1 test2
756+
```
778757

779-
```console
780-
$ mkdir -p test1/test2/test3/
781-
```
758+
```console title="创建路径 test1/test2/test3/"
759+
$ mkdir -p test1/test2/test3/
760+
```
782761

783762
### 创建文件 {#touch}
784763

@@ -789,9 +768,7 @@ $ touch FILE_NAME...
789768

790769
!!! example "创建文件示例"
791770

792-
创建两个文件,名字分别为 `file1`、`file2`:
793-
794-
```console
771+
```console title="创建两个文件,名字分别为 file1、file2"
795772
$ touch file1 file2
796773
```
797774

@@ -846,23 +823,17 @@ $ find [OPTION] PATH [EXPRESSION]
846823

847824
!!! example "搜索示例"
848825

849-
* 在当前目录搜索名为 report.pdf 的文件:
850-
851-
```console
852-
$ find . -name 'report.pdf'
853-
```
854-
855-
* 全盘搜索大于 1G 的文件:
856-
857-
```console
858-
$ find / -size +1G
859-
```
826+
```console title="在当前目录搜索名为 report.pdf 的文件"
827+
$ find . -name 'report.pdf'
828+
```
860829

861-
* 在用户目录搜索所有名为 node_modules 的文件夹:
830+
```console title="全盘搜索大于 1G 的文件"
831+
$ find / -size +1G
832+
```
862833

863-
```console
864-
$ find ~/ -name 'node_modules' -type d
865-
```
834+
```console title="在用户目录搜索所有名为 node_modules 的文件夹"
835+
$ find ~/ -name 'node_modules' -type d
836+
```
866837

867838
!!! tip "对搜索到的文件批量执行命令"
868839

@@ -1017,54 +988,42 @@ $ tar [OPTIONS] FILE...
1017988

1018989
!!! example "tar 使用实例"
1019990

1020-
* 将 `file1`、`file2`、`file3` 打包为 `target.tar`:
1021-
1022-
```console
1023-
$ tar -c -f target.tar file1 file2 file3
1024-
$ # 省略 - 符号也是可以的
1025-
$ tar cf target.tar file1 file2 file3
1026-
```
1027-
1028-
* 将 `target.tar` 中的文件提取到 `test` 目录中:
1029-
1030-
```console
1031-
$ tar -x -f target.tar -C test/
1032-
$ # 或者:
1033-
$ tar xf target.tar -C test/
1034-
```
1035-
1036-
* 将 `file1`、`file2`、`file3` 打包,并使用 gzip 算法压缩,得到压缩文件 `target.tar.gz` :
1037-
1038-
```console
1039-
$ tar -cz -f target.tar.gz file1 file2 file3
1040-
$ # 可以总是使用 -a 选项,避免记忆的麻烦
1041-
$ tar caf target.tar.gz file1 file2 file3
1042-
```
1043-
1044-
* 将压缩文件 `target.tar.gz` 解压到 `test` 目录中:
991+
```console title="将 file1、file2、file3 打包为 target.tar"
992+
$ tar -c -f target.tar file1 file2 file3
993+
$ # 省略 - 符号也是可以的
994+
$ tar cf target.tar file1 file2 file3
995+
```
1045996

1046-
```console
1047-
$ tar -xz -f target.tar.gz -C test/
1048-
$ # 或者这样
1049-
$ tar xaf target.tar.gz -C test
1050-
```
997+
```console title="将 target.tar 中的文件提取到 test 目录中"
998+
$ tar -x -f target.tar -C test/
999+
$ # 或者
1000+
$ tar xf target.tar -C test/
1001+
```
10511002

1052-
* 将 `archive1.tar`、`archive2.tar`、`archive3.tar` 三个存档文件中的文件追加到 `archive.tar` 中
1003+
```console title="将 file1、file2、file3 打包,并使用 gzip 算法压缩,得到压缩文件 target.tar.gz"
1004+
$ tar -cz -f target.tar.gz file1 file2 file3
1005+
$ # 可以总是使用 -a 选项,避免记忆的麻烦
1006+
$ tar caf target.tar.gz file1 file2 file3
1007+
```
10531008

1054-
```console
1055-
$ tar -Af archive.tar archive1.tar archive2.tar archive3.tar
1056-
```
1009+
```console title="将压缩文件 target.tar.gz 解压到 test 目录中"
1010+
$ tar -xz -f target.tar.gz -C test/
1011+
$ # 或者这样:
1012+
$ tar xaf target.tar.gz -C test
1013+
```
10571014

1058-
* 列出 `target.tar` 存档文件中的内容
1015+
```console title="将 archive1.tar、archive2.tar、archive3.tar 三个存档文件中的文件追加到 archive.tar 中"
1016+
$ tar -Af archive.tar archive1.tar archive2.tar archive3.tar
1017+
```
10591018

1060-
```console
1061-
$ tar -t -f target.tar
1062-
$ tar tf target.tar
1019+
```console title="列出 target.tar 存档文件中的内容"
1020+
$ tar -t -f target.tar
1021+
$ tar tf target.tar
10631022

1064-
$ # 打印出文件的详细信息
1065-
$ tar -tv -f target.tar
1066-
$ tar tvf target.tar
1067-
```
1023+
$ # 打印出文件的详细信息
1024+
$ tar -tv -f target.tar
1025+
$ tar tvf target.tar
1026+
```
10681027

10691028
!!! tip "存档文件的后缀名"
10701029

0 commit comments

Comments
 (0)