LinuxCommandLibrary

gnome-session

Start the GNOME desktop environment session

SYNOPSIS

gnome-session [OPTION…]

PARAMETERS

--session=<NAME>
    Load session with given name (e.g., 'gnome', 'classic')

--session-save
    Save session state before logout

--shm
    Enable shared memory for IPC (improves performance)

--fail
    Exit with error if session fails to start

--kill-only-exits
    Skip killing hung clients on logout

--replace
    Replace existing GNOME session

--restart
    Restart crashed applications

--exec=<COMMAND>
    Execute COMMAND instead of full session

--debug
    Enable debug logging

--pump
    Wait for D-Bus session bus (internal)

--wait
    Wait for init script completion

--help
    Display usage help

--version
    Show version information

DESCRIPTION

gnome-session is the core session manager for the GNOME desktop environment. It initializes the desktop session, launches essential components like the GNOME Shell, manages running applications, and handles session persistence by saving and restoring the state of open windows and programs.

Upon startup, it reads session definitions from /usr/share/gnome/default.session or user overrides in ~/.config/gnome-session. It communicates via D-Bus for services like power management and integrates with systemd-logind for tracking user sessions.

The command supports custom sessions for different desktop layouts (e.g., classic, Wayland). It processes logout signals, terminates clients cleanly (or forcefully), and can trigger system shutdown or suspend. Typically launched by display managers like GDM, it can also run manually in X11 or Wayland contexts.

Key features include crash recovery via --restart, shared memory optimization for performance, and replacement of existing sessions without logout. It's essential for GNOME users but requires a graphical environment.

CAVEATS

Requires graphical session (X11/Wayland); not for headless servers. May conflict with other WMs. Custom sessions need matching .session files.

CONFIGURATION FILES

User sessions in ~/.config/gnome-session/saved-session; system templates in /usr/share/gnome-session/sessions/. Edit with gnome-session-properties.

EXIT CODES

0: Success
1: General error
2: Session start failed

HISTORY

Introduced in early GNOME 1.x (1997) as part of TheMC project. Evolved through GNOME 2 (Metacity WM) to GNOME 3+ (GNOME Shell, Mutter). Shifted to Wayland support in GNOME 40+; now systemd-integrated for modern distros.

SEE ALSO

gnome-session-properties(1), gdm(8), loginctl(1), systemd-logind(8)

Copied to clipboard