これは、なにをしたくて書いたもの?
Ubuntu Linux 24.04 LTSでウィンドウマネージャーにはGNOME Shellを使っているのですが(かつX Windows System)、たまにおかしな状態で
起動していることがあり、その時は再ログインしていたのですがそもそもコマンドでGNOMEを再起動できるようなのでメモとして。
環境
今回の環境はこちら。Ubuntu Linux 24.04 LTSです。
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 24.04.2 LTS Release: 24.04 Codename: noble $ uname -srvmpio Linux 6.8.0-55-generic #57-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 12 23:42:21 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
$ printenv XDG_SESSION_TYPE x11
ウィンドウマネージャーはgdm(gdm3)です。
$ systemctl status display-manager
● gdm.service - GNOME Display Manager
Loaded: loaded (/usr/lib/systemd/system/gdm.service; static)
Active: active (running) since Sat 2025-03-22 11:55:04 JST; 1h 57min ago
Process: 16851 ExecStartPre=/usr/share/gdm/generate-config (code=exited, status=0/SUCCESS)
Main PID: 16857 (gdm3)
Tasks: 4 (limit: 38003)
Memory: 3.8M (peak: 21.6M)
CPU: 133ms
CGroup: /system.slice/gdm.service
└─16857 /usr/sbin/gdm3
GNOME Shellを再起動する
どうすればいいかですが、こちらに書いてありました。
Typing 'r' or 'restart' in the Alt+F2 prompt will restart GNOME Shell. This is useful when you are make changes to the GNOME Shell code while working within the GNOME Shell. You don't need to compile anything if you only changed JavaScript code, but you need to run compilation as you would normally do for C code before restarting.
Projects/GnomeShell/CheatSheet / Developer toolsGnomeShell(2f)CheatSheet.html#Developer_tools)
Alt+F2でプロンプトが起動するので、そこでrまたはrestartと入力します。
こんな感じです。

これでGNOME Shellが再起動します。