Skip to content

Commit 6f32e1e

Browse files
committed
feat: add getcap. fix #644
1 parent 87a3114 commit 6f32e1e

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

command/getcap.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
getcap
2+
===
3+
4+
显示文件的能力(capabilities)
5+
6+
## 补充说明
7+
8+
**getcap命令** 用于查看文件的能力(capabilities)。在 Linux 中,文件的能力是一种权限控制机制,可以赋予普通文件特定的特权操作,而无需完全的 root 权限。
9+
10+
### 语法
11+
12+
```shell
13+
getcap [选项] [文件名...]
14+
```
15+
16+
### 选项
17+
18+
```shell
19+
-v # 显示详细信息,通常与其他选项一起使用。
20+
-p # 显示进程的能力。
21+
```
22+
23+
### 参数
24+
25+
文件名:指定要查看能力的文件路径。
26+
27+
### 实例
28+
29+
查看一个可执行文件的能力:
30+
31+
```shell
32+
$ getcap /usr/bin/ping
33+
/usr/bin/ping = cap_net_raw+ep
34+
```
35+
36+
查看当前目录下所有文件的能力:
37+
38+
```shell
39+
$ getcap *
40+
/usr/bin/ping = cap_net_raw+ep
41+
```
42+
43+
如果文件没有设置任何能力,getcap 不会返回任何输出。
44+
45+
查看进程的能力(以 PID 为例):
46+
47+
```shell
48+
$ getcap -p 1234
49+
```

0 commit comments

Comments
 (0)