Gedit is the default text editor and part of the GNOME Core Applications that are installed generally as part of the GNOME Desktop Environment on various Linux systems. The text editor is a general-purpose lightweight editor with a clean, simple GUI similar to the notepad application from Windows.
In the following tutorial, you will learn how to install Gedit on Ubuntu 22.04 LTS Jammy Jellyfish using the Ubuntu default repository or alternative snap and flatpak installation managers.
Table of Contents
Update Ubuntu
Before going into the tutorial, the first step is to run an apt update, which ensures your system is up-to-date to avoid any conflicts.
sudo apt update && sudo apt upgrade -y
Install Gedit – APT Method
The first option is to install Gedit using the apt command from Ubuntu 22.04 repository. For most users, this is the most recommended way to install it.
In your terminal, use the following command to install the text editor.
sudo apt install gedit -y
Install Gedit – Flatpak Method
The second option is to use the Flatpak package manager, which is not installed on Ubuntu distributions, given Snap, which is Flatpak’s rival, is owned by Canonical and Ubuntu. However, Flatpak is still available to install from Ubuntu’s default repository.
First, install the Flatpak manager; this can be skipped if you already have it installed.
sudo apt install flatpak -y
Next, you need to enable Flatpack using the following command in your terminal:
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
For users installing Flatpak for the first time, it is often recommended to reboot your system. Failure to do this can occur with odd issues arising, such as paths not being generated for icons.
reboot
SKIP THE REBOOT IF FLATPAK IS INSTALLED.
Now install using the following flatpak command.
flatpak install flathub org.gnome.gedit -y
Install Gedit – Snap Method
The third method will be installing with snap. The Snapcraft package manager should be installed on Ubuntu-installed systems unless removed previously.
Currently, all three methods are up-to-date and are separated by a matter of a day or so when it comes to updates, so it is a choice of which package manager you prefer to use.
First, re-install Snapd if you have removed it previously.
sudo snap install snapd -y
Ideally, it is worth rebooting when installing third-party managers; if you experience issues, please do this.
Next, install the snap core to avoid any conflicts.
sudo snap install core
Next, some packages come in classic, so you need to create a symlink to enable classic snap support.
sudo ln -s /var/lib/snapd/snap /snap
Now install the text editor package with the following command.
sudo snap install gedit
How to Launch Gedit
Now that you have the text editor installed, launching can be done in two ways.
In your terminal type:
gedit
Alternatively, Flatpak users will need to launch using the command below from a terminal instance:
flatpak run org.gnome.gedit
However, this isn’t practical, and you would use the following path on your desktop.
Activities > Show Applications > Text Editor (gedit).
Example:
Once open, you can create notes or open files. One example of using the command terminal is to use the gedit to open configuration files if you know the path instead of browsing through graphical directories trying to find it.
Example with Nginx configuration file.
gedit /etc/nginx/nginx.conf
Example:
How to Update/Upgrade gedit
Depending on the method of installation used, the following commands can be used to update.
APT Update Method
sudo apt upgrade && sudo apt upgrade
Flatpak Update Method
flatpak update
Snap Update Method
sudo snap update
How to Remove (Uninstall) gedit
Use one of the following commands to suit the original installation method for users who no longer require the application.
APT Remove Method
sudo apt autoremove gedit -y
Flatpak Remove Method
flatpak uninstall --delete-data flathub org.gnome.gedit -y
Next, run the following command for any leftover clean-up.
flatpak remove --unused
Snap Remove Method
sudo snap remove gedit
Comments and Conclusion
In the tutorial, you have learned how to install Gedit on Ubuntu 22.04 LTS desktop.
As explained at the start of the tutorial, the default text editor in the GNOME desktop environment is Gedit. It can be used for everything from writing code to editing documents, and it’s lightweight enough that you won’t need another application by your side while working on big projects or finishing up some homework assignments!