Ubuntu 14.04在Dash加载关机/重启选项的方法
Ubuntu 14.04是一个(ge)流行的Linux发行版,它提供了许多强(qiang)大的功能(neng)和工(gong)具,其中之一就是(shi)Dash,它是一个快速搜索和启动应用程序的工具,有时候我们可(ke)能会发现在Dash中无法找到关机或重启选项,在本文中,我们将介绍如何在Ubuntu 14.04的Dash中加(jia)载关机/重启选项。


方法一:使(shi)用(yong)命令行

关机:sudo shutdown -h now
重启:sudo shutdown -r now
这些命令需要管理员权限,因此我们需要使用sudo命令。-h参数表示关(guan)机,-r参数表示重启。now表(biao)示立即执行操作。
方法二:创建快捷方(fang)式(shi)
另一种方法是创建一个快捷方式来执行关机或重启操作,打开终端并输入以下命令:
gedit ~/.local/share/applications/reboot.desktop
这将(jiang)打开一个文本编辑器,其中包含一个名为reboot.desktop的文件,在该文件中,添加以下内容:
[Desktop Entry]Type=ApplicationExec=sudo rebootHidden=falseNoDisplay=falseX-GNOME-Autostart-enabled=trueName=RebootComment=Reboot the systemIcon=system-reboot保存并关闭文件,在终端中输入以下命令来创建关(guan)机快捷方式:
gedit ~/.local/share/applications/shutdown.desktop在该文件中,添加以下内容:
[Desktop Entry]Type=ApplicationExec=sudo shutdown -h nowHidden=falseNoDisplay=falseX-GNOME-Autostart-enabled=trueName=ShutdownComment=Shutdown the systemIcon=system-shutdown
保(bao)存并关闭文件,现(xian)在,您可以在Dash中找到关机和(he)重启的快捷方式,点击它们即可执行相应的操作。
方法(fa)三:使用(yong)图形界面工具
如果您更(geng)喜欢使用图形界面工具来执行关机或重启操作,可以使(shi)用systemctl命令,打开(kai)终端并输入以下命令:
sudo apt-get install gnome-session-manager system-config-printer gnome-tweak-tool gnome-power-manager gnome-settings-daemon gnome-control-center powernap --no-install-recommends --assume-yes
这将安装一些(xie)必要的软件包,重新启动计算机,现在(zai),您应该能够在Dash中找到关机和重启的选项,点击它们即可执行相应的操作。
方法四:编辑启动应用程序列表
您还可以通(tong)过编辑启动应用程序列表来添加关机和重启的选项,打(da)开终端并输入以(yi)下(xia)命令:
gedit ~/.config/autostart/shutdown.desktop & gedit ~/.config/autostart/reboot.desktop[Desktop Entry]Type=ApplicationExec=sudo shutdown -h now & sudo reboot & Command to execute when the user logs in. (Replace this with your command) Name=Shutdown & Comment=Shutdown the system & Icon=system-shutdown & This line is optional, but it helps to identify the application in the Dash menu. X-GNOME-Autostart-enabled=true & X-GNOME-Autostart-Delay=10 & The delay before the application starts, in seconds. You can adjust this value as needed. X-GNOME-Autostart-User=your_username & Your username, if different from your current user. End of file. [Desktop Entry] Type=Application Exec=sudo reboot & Name=Reboot & Comment=Reboot the system & Icon=system-reboot & This line is optional, but it helps to identify the application in the Dash menu. X-GNOME-Autostart-enabled=true & X-GNOME-Autostart-Delay=10 & The delay before the application starts, in seconds. You can adjust this value as needed. X-GNOME-Autostart-User=your_username & Your username, if different from your current user. End of file. Save and close both files.现在,当您登录时(shi),系统将自动执行您在(zai)启动应用程(cheng)序列(lie)表中指定的(de)关机或重启命令,您可以根据需要自定义这些命令。
电话:13345193196
网 址:http://hdthjs.com/
邮 箱:97675878@qq.com
地 址:上海市静安66号