Stop Ubuntu Text Editor from Terminal | Kill Gedit & Background Apps
Calculator Team
Verified Contributor
Stop a Background Text Editor in Ubuntu (Terminal Only)
If a text editor like Gedit is running in the background (minimized or frozen) and you want to kill it directly from the terminal — without clicking any windows — here are the fastest methods.
1. Quickest way: kill by name
Use pkill followed by the editor's process name: pkill gedit. For newer GNOME Text Editor: pkill gnome-text-editor. For Mousepad or Leafpad: pkill mousepad or pkill leafpad.
2. When the name has spaces: "Text Editor"
If the process shows as "Text Editor" (with space), the command pkill Text Editor will fail. Use -f flag to match the full command line: pkill -f "Text Editor".
3. Force kill a frozen editor
If the editor is completely unresponsive, send a SIGKILL signal: pkill -9 gedit. Or find PID first: ps aux | grep gedit, then kill -9 [PID]. Caution: Force kill will not save unsaved changes. Use only when necessary.
4. Identify before killing (pro tip)
Run this to see exactly which text editor processes are active: ps aux | grep -E "gedit|gnome-text-editor|mousepad|leafpad" | grep -v grep. Then terminate the correct one using the commands above.
Quick command reference
Normal close (graceful): pkill gedit. App name includes spaces: pkill -f "Text Editor". Kill all instances: killall gedit. Frozen editor: pkill -9 gedit. Find running editor: ps aux | grep -i editor.
No mouse needed — clean terminal workflow for Ubuntu, Debian, and Pop!_OS.