我的 shell bash 给了我一个bash : ... : command not found
错误,我不知道如何开始解决它。另外,我不知道应该选择除了“bash”“Debian”之外的女巫标签。
我是 root,这两个程序也已经安装了。操作系统是 Debian Buster 并且是新安装的。在安装过程中,我取消勾选了 Tasksel 配置步骤中的所有选项。我认为更多地与我的Shell有关。后来,我用来安装Awesome tiling windows。
这是我的路径的输出:
root@machine:~# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
这里有两个例子:首先我尝试运行该程序。其次,我检查该程序是否已安装。
root@machine:~# modprobe --verbose
bash: modprobe: command not found
root@adrien:~# apt-get install kmod
Reading package lists...
Done Building dependency tree
Reading state information...
Done kmod is already the newest version (26-1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@machine:~# openvpn
bash: openvpn: command not found
root@adrien:~# apt-get install openvpn
Reading package lists... Done Building dependency tree
Reading state information...
Done openvpn is already the newest version (2.4.7-1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Run Code Online (Sandbox Code Playgroud)
检查一下你的$PATH
里面是否有这些程序。
$ echo $PATH
Run Code Online (Sandbox Code Playgroud)
应该显示您的系统搜索路径是什么。与什么比较
$ dpkg-query -L <package_name>
Run Code Online (Sandbox Code Playgroud)
会告诉你的。
$ command -v program
Run Code Online (Sandbox Code Playgroud)
会告诉您程序的完整/绝对路径。
如果您无法通过这种方式找到它,请尝试:
find /sbin modprobe
find /usr/sbin modprobe
Run Code Online (Sandbox Code Playgroud)
Modprobe 驻留在/sbin
(或者可能位于/usr/sbin
)并且是到 的符号链接/bin/kmod
。如果您没有 modprobe 所在目录的路径,您将无法使用它,除非您提供完整路径,例如$ /sbin/modprobe
.
您可以发送结果$ set | grep PATH
,我们可能会看看有什么问题。
由于您的输出PATH
表明您没有/sbin
and /usr/sbin
,因此您必须将其添加到您的$HOME/.bashrc
. 要测试它,首先使用:
$ export PATH=$PATH:/sbin:/usr/sbin
Run Code Online (Sandbox Code Playgroud)
并检查它是否有效。如果是这样,则将其添加到$HOME/.bashrc
,如果您希望每个用户都可以使用它,则将其添加到/etc/profile
@GAD3R 建议的位置。
附言。$
是命令提示符,你不把它放在控制台中,它表明命令是在shell中使用的。一般来说,for 普通用户$
用作 shell 提示符,而#
for root
. 因为这可能是一般问题,而不仅仅是 root,所以我使用了$
. 请记住,在您的情况下,当您root
$“成为”# 但由于您已经以 root 身份登录,因此不会改变任何内容。
归档时间: |
|
查看次数: |
9941 次 |
最近记录: |