Skip to content

Commit

Permalink
add sha256sum.md (#480)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed May 31, 2023
1 parent c6c837f commit 1668d79
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
4 changes: 2 additions & 2 deletions command/sh.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ shell命令解释器

**sh命令** 是shell命令语言解释器,执行命令从标准输入读取或从一个文件中读取。通过用户输入命令,和内核进行沟通!Bourne Again Shell (即bash)是自由软件基金会(GNU)开发的一个Shell,它是Linux系统中一个默认的Shell。Bash不但与Bourne Shell兼容,还继承了C Shell、Korn Shell等优点。

### 语法
### 语法

```shell
bash [options] [file]
```

### 选项
### 选项

```shell
-c string:命令从-c后的字符串读取。
Expand Down
62 changes: 62 additions & 0 deletions command/sha256sum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
sha256sum
===

用于计算文件的 SHA-256 哈希值

## 补充说明

**sha256sum命令** 是打印或检查 SHA256(256位)校验

### 语法

```shell
sha256sum [OPTION]... [FILE]...
```

### 选项

```shell
-b, --binary # 以二进制模式读取
-c, --check # 从文件中读取 SHA256 校验和并进行检查
--tag # 创建 BSD 风格的校验和
-t, --text # 以文本模式读取(默认)
-z, --zero # 每行输出以 NUL 结尾,而不是换行符,并禁用文件名转义
--help # 显示此帮助并退出
--version # 输出版本信息并退出
```

### 实例

以下是一些使用 sha256sum 命令的示例:

1. 计算文件的 SHA-256 哈希值

```
sha256sum file.txt
```

这将会输出文件 file.txt 的 SHA-256 哈希值和文件名。

2. 计算多个文件的 SHA-256 哈希值

```
sha256sum file1.txt file2.txt
```

这将会输出文件 file1.txt 和 file2.txt 的 SHA-256 哈希值和文件名。

3. 将 SHA-256 哈希值保存到文件中

```
sha256sum file.txt > hash.txt
```

这将会将文件 file.txt 的 SHA-256 哈希值保存到文件 hash.txt 中。

4. 验证文件的 SHA-256 哈希值

```
sha256sum -c hash.txt
```

这将会验证文件的 SHA-256 哈希值是否与 hash.txt 中的值匹配。如果匹配,输出 OK,否则输出 FAILED。

0 comments on commit 1668d79

Please sign in to comment.