gpt4 book ai didi

linux - 如何使用 shell 从计算机注销?

转载 作者:IT王子 更新时间:2023-10-29 00:19:27 26 4
gpt4 key购买 nike

如何使用 shell 注销我的计算机,以便再次出现登录窗口?

我的一个 Linux 脚本中需要此功能。

更新:我想复制在我的 Ubuntu 的注销按钮后面工作的代码。

使用的桌面环境:GNOME

最佳答案

我认为这可以完成工作:

gnome-session-save --logout

此外,请查看 --help 输出,也许您想使用 --force-logout 选项。

Usage:
gnome-session-save [OPTION...]

Help Options:
-h, --help Show help options
--help-all Show all help options
--help-gtk Show GTK+ Options

Application Options:
--logout Log out
--force-logout Log out, ignoring any existing inhibitors
--logout-dialog Show logout dialog
--shutdown-dialog Show shutdown dialog
--gui Use dialog boxes for errors
--display=DISPLAY X display to use

关于linux - 如何使用 shell 从计算机注销?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2996525/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com