当前位置:首页 > Linux > Debian > 正文内容

"bash:shutdown:command not found"或"bash:reboot:command not found"的解决方法

deboss2年前 (2023-03-16)Debian69

解决“bash:reboot:找不到命令”的问题

在虚拟机装了个Debian,结果被关机重启命令给弄懵了,能用systemctl reboot命令来重启,reboot不行。

查了一下:reboot只是一个 systemctl reboot的一个连接,所以,当执行reboot时,其实就是执行 systemctl reboot.


网上有说改.bash_profile的,但我debian-4.19.0-8-amd64版本

里面没有.bash_profile文件


所以用到/etc/profile来修改环境变量

但必须用sudo执行(比如sudo + reboot/shutdown/halt)


whereis reboot(找到reboot的文件路径)

https://img-blog.csdnimg.cn/2020040423242667.png


找到/etc/profile 这个配置文件后,进入文件改写

sudo vim /etc/profile


加入下面这句话

export PATH=$PATH:xxx(xxx是你的reboot文件的目录路径)

比如上面图片中我的reboot文件路径是/usr/sbin


保存退出后别忘了source /etc/profile


然后sudo reboot就行了


换做shutdown也类似

whereis shutdown(找到shutdown的文件路径)



找到/etc/profile 这个配置文件后,进入文件改写

sudo vim /etc/profile


加入下面这句话

export PATH=$PATH:xxx(xxx是你的shutdown文件的目录路径)

比如上面图片中我的shutdown文件路径是/usr/sbin


保存退出后别忘了source /etc/profile


然后sudo shutdown就行了


其他的关机重启命令:init 0(关机),init 6(重启)

————————————————

版权声明:本文为CSDN博主「夜里的雨」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/bell_love/article/details/105320031


扫描二维码推送至手机访问。

版权声明:本文由四川方脑壳发布,如需转载请注明出处。

本文链接:https://sc.six666.cn/?id=7

分享给朋友:
返回列表

没有更早的文章了...

下一篇:Debian中修改时区

“"bash:shutdown:command not found"或"bash:reboot:command not found"的解决方法” 的相关文章

Debian 12 CD-ROM 源修改为网络源

一台机器安装Debian时选择了CD-ROM作为更新源,apt-get 时提示如下错误:Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-RO...

debian各版本下载地址获取

debian各版本下载地址获取直达地址 https://cdimage.debian.org/cdimage/archive/安装系统只需要DVD1就行了,后面都是可选软件包,可用于离线安装软件的debian 的 live CD 和普通版有什么区别?Live 安装映像包含一个 Debian 系统,可...