GNU Emacs is more than just a text editor; it is a powerful tool for programmers and other power users. At its core is an interpreter for Emacs Lisp, a dialect of the Lisp programming language with extensions to support text editing. This makes Emacs highly extensible; users can add new functionality by writing their own Emacs Lisp code or installing packages that add new features.
Emacs is also customizable, allowing users to change almost every aspect of how it looks and behaves. As a result, Emacs has something to offer everyone, from novice users who appreciate its simple interface to experienced programmers who can take advantage of its powerful features. No matter how you use it, Emacs is sure to make your life easier.
The following tutorial will teach you how to install Emacs on Ubuntu 22.04 LTS Jammy Jellyfish using a LaunchPAD APT PPA or Flatpak with the command line terminal.
Update Ubuntu
First, update your system to ensure all existing packages are up to date to avoid conflicts.
sudo apt update && sudo apt upgrade -y
Install GNU Emacs – APT PPA Method
The best APT package manager method is importing and installing the PPA by Kevin Kelley.
sudo add-apt-repository ppa:kelleyk/emacs -y
Before you continue, run an APT update to reflect the newly imported PPA.
sudo apt update
Now install the text editor.
sudo apt-get install emacs28
Headless environments such as Ubuntu servers can only install the Emacs terminal variation using the following command.
sudo apt install emacs28-nox
Currently, version 28 is the latest version.
Install GNU Emacs – Flatpak Method
The second option is to use the Flatpak package manager. Flatpak is not installed natively on Ubuntu 22.04, given Canonical is behind both Ubuntu and Snaps, but it is available to install if you so wish.
First, install the Flatpak manager if it was removed previously.
sudo apt install flatpak -y
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, such as paths not being generated for icons.
sudo reboot
SKIP THE REBOOT IF FLATPAK IS INSTALLED.
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
Now install Emacs using the following flatpak command.
flatpak install flathub org.gnu.emacs -y
How to Launch GNU Emacs (GUI or Terminal)
Launching can be done in a few ways now that you have the software installed.
First, the software can be launched using the following command for desktop users.
emacs
Secondly, Ubuntu server users can use the following command in a headless environment.
emacs-nox
Alternatively, Flatpak users will need to launch using the command below from a terminal instance.
flatpak run org.gnu.emacs
Most desktop users may elect to use the application icon, which can be achieved using the following path.
Activities > Show Applications> Emacs (GUI or Terminal).
Depending on the option you choose using the graphical UI or terminal, you will arrive at the text editor. For new users, check out the Emacs documentation.
How to Update/Upgrade GNU Emacs
The best method to ensure your installation of Emacs is up-to-date is to open the command line terminal and run the following command.
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
The command will also ensure all other packages that use the APT package manager, including your system packages, are up-to-date. I suggest that users new to Linux run this command frequently to ensure your system works as intended, even if you have automatic GUI updates or notifications.
How to Remove (Uninstall) GNU Emacs
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 emacs* -y
Next, you should remove the PPA for users who will not use the software again.
sudo add-apt-repository --remove ppa:kelleyk/emacs -y
Flatpak Remove Method
flatpak uninstall --delete-data org.gnu.emacs
Next, run the following command for any leftover clean-up.
flatpak remove --unused
Comments and Conclusion
GNU Emacs is the editor for you if you’re looking for a powerful, extensible text editor that can be customized to do just about anything you need. With its Lisp interpreter and a vast array of extensions, GNU Emacs can be tailored to fit your specific needs – no matter how unique they may be.