“which”无法找到命令,即使它确实已安装

rfu*_*877 5 linux debian path which command

我最近安装了cryptsetup. 我已经仔细检查过sudo apt-get install cryptsetup

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
cryptsetup is already the newest version (2:2.3.7-1+deb11u1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试使用该命令时,它无法识别它。

bash: cryptsetup: command not found
Run Code Online (Sandbox Code Playgroud)

然后我尝试使用 查找命令的位置whichwhich cryptsetup

但是该命令不会返回任何内容。man cryptsetup说这cryptsetup确实是正确的命令名称。这里有什么问题吗?

Ste*_*itt 15

cryptsetup安装在,默认情况下/sbin是 users\xe2\x80\x99 上的 \xe2\x80\x99t ;PATH结果,which找不到\xe2\x80\x99。

\n

如果您which以 root 身份运行,它应该会找到cryptsetup

\n
$ which cryptsetup\ncryptsetup not found\n$ sudo which cryptsetup\n/sbin/cryptsetup\n
Run Code Online (Sandbox Code Playgroud)\n

(关于which,请参阅为什么不使用“which”?那么使用什么?

\n