From 6f32e1e9ee44886a06198fda0ac5f44445bb9c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=BC=9F=E8=B0=83=E8=B0=83?= <398188662@qq.com> Date: Sun, 27 Apr 2025 17:18:20 +0800 Subject: [PATCH] feat: add getcap. fix #644 --- command/getcap.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 command/getcap.md diff --git a/command/getcap.md b/command/getcap.md new file mode 100644 index 0000000000..1f57f464b5 --- /dev/null +++ b/command/getcap.md @@ -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 +``` \ No newline at end of file