Ubuntu

How To Install Emacs Text Editor on Ubuntu 22.04

Emacs is an amazing text editor available on all major operating systems from BSD to Linux to macOS and Windows. One of the biggest reasons people love Emacs is that it comes loaded with a wide range of commands designed for the simplest and the most complex tasks. It has almost 40 years of plugin development and configuration hacks working for it.

In this guide, we will install the emacs-gtk package, which is a GUI package of Emacs based on the GTK+ package rather than Lucid.

Update the apt Database

Updating this database before any installation is always a good idea. It helps resolve any system-level dependencies for the new application. In your terminal, type the following to start the update:

$sudo apt update

After the update is complete, we can use the traditional method to install the Emacs text editor.

Installing Emacs-gtk

To install Emacs, type the following to start the installation process for emacs-gtk:

$sudo apt -y install emacs-gtk

Depending on the speed of your Internet connection, the process will approximately take a minute to complete the installation. Once the prompt returns without errors, you should know that the installation has been successfully completed.

Running Emacs

Once the installation has been completed, simply type “emacs” in your terminal, and it will launch the text editor:

$emacs

You need to be sure that the text editor is tied to the terminal which launched it. If you close the terminal, the Emacs will close along with it. Or, if you prefer the GUI way, you can always go into applications to launch it.

Learning Emacs

If by now you are feeling overwhelmed, you shouldn’t worry. There is an extensive community and detailed tutorials within the editor itself. You can click on any of the following to get started:

Uninstalling Emacs

When you’re done with the project, or you simply want to uninstall with the text editor, you can uninstall it with the following:

$sudo apt remove emacs-gtk

Uninstalling Along With Dependencies

To uninstall emacs-gtk along with all of its dependencies, we can use the following:

$sudo apt-get -y autoremove emacs-gtk

Remove the Configs Along With the Data

If you don’t want simply to uninstall, and you want to get rid of all the configuration files along with all the data, you can use the following to uninstall along with the removal of configs and data:

$sudo apt-get purge emacs-gtk

Leaving No Trail Behind

If you have limited resources and want to get rid of every single thing related to Emacs from your Ubuntu 22.04, use the following:

$sudo apt-get -y autoremove –purge emacs-gtk

Conclusion

Emacs is older than many of the modern computing conventions in some of the other packages. Due to this, you will see outdated terminology like “visiting” a file instead of opening it and “writing” instead of saving a file. Thus, Emacs is often viewed as intricate and even enigmatic. But, once you learn the basics, you’ll understand the whole power behind the platform. If this has piqued your interest, you can head to LinuxHint or their website to learn more.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.