feat: add getcap. fix #644

This commit is contained in:
小弟调调 2025-04-27 17:18:20 +08:00
parent 87a3114a84
commit 6f32e1e9ee
1 changed files with 49 additions and 0 deletions

49
command/getcap.md Normal file
View File

@ -0,0 +1,49 @@
getcap
===
显示文件的能力capabilities
## 补充说明
**getcap命令** 用于查看文件的能力capabilities。在 Linux 中,文件的能力是一种权限控制机制,可以赋予普通文件特定的特权操作,而无需完全的 root 权限。
### 语法
```shell
getcap [选项] [文件名...]
```
### 选项
```shell
-v # 显示详细信息,通常与其他选项一起使用。
-p # 显示进程的能力。
```
### 参数
文件名:指定要查看能力的文件路径。
### 实例
查看一个可执行文件的能力:
```shell
$ getcap /usr/bin/ping
/usr/bin/ping = cap_net_raw+ep
```
查看当前目录下所有文件的能力:
```shell
$ getcap *
/usr/bin/ping = cap_net_raw+ep
```
如果文件没有设置任何能力getcap 不会返回任何输出。
查看进程的能力(以 PID 为例):
```shell
$ getcap -p 1234
```