LinuxCommandLibrary

gnome-session-quit

Log out or shut down GNOME session

SYNOPSIS

gnome-session-quit [--logout | --poweroff | --reboot] [--force]

PARAMETERS

--logout
    Request logout from the GNOME session

--poweroff
    Request system poweroff

--reboot
    Request system reboot

--force
    Skip confirmation dialog

--help
    Display help information

--version
    Display version information

DESCRIPTION

gnome-session-quit is a command-line tool in the GNOME desktop environment for programmatically ending the current user session. It sends requests to the GNOME session manager via D-Bus to initiate logout, poweroff, or reboot actions. This utility is ideal for scripts, automation tasks, or terminal-based session control when graphical menus are inaccessible.

By default, the command displays a confirmation dialog before proceeding, ensuring users do not accidentally end their session. The --force option bypasses this prompt for unattended operations. It respects system policies, such as requiring authentication for privileged actions like shutdown.

The tool integrates seamlessly with GNOME Shell and integrates with systemd-logind for power management. It does not work outside a GNOME session or on non-GNOME desktops. Exit status indicates success (0), failure (1), or cancellation (2).

Common use cases include cron jobs for timed logouts or desktop launchers for quick session termination.

CAVEATS

Only works in an active GNOME session; requires polkit authorization for poweroff/reboot; may fail under Wayland without proper session setup.

EXAMPLES

gnome-session-quit --logout
Logs out after confirmation.

gnome-session-quit --poweroff --force
Powers off without prompting.

gnome-session-quit --reboot
Reboots with dialog.

EXIT STATUS

0: success
1: error (e.g., invalid option)
2: cancelled by user

HISTORY

Part of gnome-session package since GNOME 2.16 (2006); enhanced in GNOME 3 for Shell integration; minor updates in GNOME 40+ for Wayland compatibility.

SEE ALSO

Copied to clipboard