An Overview of Emacs Text Editor in Linux

Emacs stands for Editor MACroS, is a text-editing application that has been around for 40 years in Linux.  It is known for its extensibility and versatility, offering a wide range of features beyond basic text editing. It is not just a text editor, but can also function as an IDE (Integrated Development Environment) and even as a platform for creating and running applications.

What is Emacs in Linux?

Emacs is a feature-efficient text-editing tool that can be run on UNIX, LINUX, BSD, Mac, and even Windows systems. It was first developed in the MIT AI lab in 1976. There are many variants of Emacs in Linux and GNU Emacs is the most widely used Emacs. Now, GNU Emacs is not just an editor but has the functionality of more than an IDE. It has numerous built-in commands and macros and great flexibility overall.

Emacs logo

Emacs Lisp Code for Emacs in Linux

LISP is one of the oldest programming languages in the world. Emacs Lisp was developed using the common LISP language but it is very simple and easy to apply even though it is a full-fledged programming language. Subsequently, this language can be used to edit and customize Emacs as you wish. So, this text editor will give you great flexibility and many professionals use Emacs just for this feature.

Lisp language logo

Features of Emacs Editor in Linux

Emacs is one of the oldest text editors released in the world. It is known for its features and functionalities. Now, Emacs has many features that make it one of the favorite text editors in Linux.

Some of the features that keep it apart from other text editors are as follows:

Emacs in Linux GUI

A. Content-aware Editing

Emacs is smart and understands the type of text written inside the program. For programming codes, it can easily distinguish between language and other text and gives syntax coloring for many different file types. As a result,  comes in handy for coding and understanding the logic behind a program.

B. Complete Unicode Support

Emacs supports complete Unicode support. That means you can use any type of known symbols and characters inside Emacs. This turns Emacs into a widely usable text editor that can edit and develop any type of text from basic text to research paper, from basic coding to total app development.

C. Customizable Using Lisp Code

Emacs has a built-in LISP interpreter, which means it can run Emacs Lisp code and make customization inside the text editor. As a result, it is widely versatile and very useful for professionals. Though it has a steep learning curve, it is worth the effort and can certainly give you more options. That’s why many professionals still use Emacs even though it is quite an old text editor.

D. More Than Just a Text Editor or IDE

Emacs was originally a text editor, but now it has become more than an IDE. Currently,  Emacs can do pretty much anything a general IDE can do. It can compile, run, and test most of the most well-known programming languages and work seamlessly. Additionally, Emacs integrates with GDB to provide an IDE and it is widely popular for its multi-purpose usage.

You can even use Emacs as a calendar, file explorer, debugger, and even mail application. Truly, It is a multipurpose application that has become more like an Operating system than just a text editor.

E. Lightweight

Emacs is a lightweight application that can be installed in Linux quite easily. It has a GUI and even a Terminal version as well. So most of the users will be able to cope with its functionality and love the overall seamless usage. As it does not have any bulky heavy form, most users like to work with it for simplicity.

Emacs Editor Keyboard Shortcuts in Linux

Emacs has many shortcuts or Keybindings. These Keybindings are not required, but they help by increasing productivity. So, Professional developers use them a lot. The emphasis of these Keybindings is never to move had from the alphanumeric keys or the normal keys.

To do that, CTRL and ALT are used extensively to apply commands. Here you will find many of the Keybindings present in Emacs.

A. Movement Keys

These keys are used to move between characters, words, lines, etc. You can use these Keybindings to start using movement keys without taking your hands from the alphanumeric keys. The list of them is as follows:

Serial No. Shortcut Keys Functions
1. CTRL+B Moves the cursor one character forward.
2. CTRL+F Moves the cursor one character backward.
3. ALT+B Moves the cursor one word forward.
4. ALT+F Moves the cursor one word backward.
5. CTRL+P Moves the cursor one line forward.
6. CTRL+N Moves the cursor one line backward.
7. CTRL+A Goes to the line beginning.
8. CTRL+E Goes to the line ending.

B. Killing or Deleting Keys

Here are the shortcut keys for deleting or killing characters, words, and lines:

Serial No. Shortcut Keys Functions
1. DEL Deletes a character backward.
2. CTRL+D Deletes a character in the forward.
3. ALT+DEL Deletes a word backward.
4. ALT+D Deletes a word in the forward.
5. ALT+0 Deletes a line backward.
6. CTRL+K Deletes a line in the forward.
7. CTRL+Y Yanks back the last thing killed.
8. ALT+Y Replaces the last yank with the previous kill.

C. Search Keys

You may want to search for some words or characters in Emacs and to do that you can use the incremental search keys quite easily. Below are these search keys:

Serial No. Shortcut Keys Functions
1. CTRL+S Searches forward.
2. CTRL+R Searches backward.
3. CTRL+ALT+S Regular Expression searches forward.
4. CTRL+ALT+R Regular Expression searches backward.
5. ENTER Exits incremental search.
6. DEL Undo the effect of the last character.
7. CTRL+G Aborts current search.

D. File Keys

There are also many Keybindings for working with files. Here are some of the file management Keybindings:

Serial No. Shortcut Keys Functions
1. CTRL+X   CTRL+F Reads a file.
2. CTRL+X   CTRL+S Saves a file.
3. CTRL+X   S Saves all files.
4. CTRL+X  I Inserts the content of another file.
5. CTRL+X   CTRL+F Replaces this file with another file.

E. Replace Keys

You can replace a text with another one using some of these keybindings. Some of these replace keys are:

Serial No. Shortcut Keys Functions
1. ALT+% Interactively replaces a text or string.
2. ALT+X   regex Using regular expression.
3. SPACE/Y Replaces.
4. DEL/N Skips.
5. ! Replaces all.

F. Getting Help Keys

You can search for help in Emacs using the following Keybindings. Check out the following list of getting help keys:

Serial No. Shortcut Keys Functions
1. CTRL+H Help window.
2. CTRL+X   1 Scrolls the help window.
3. CTRL+H   A Shows command matching a string.
4. CTRL+H   K Describes the function a key runs.
5. CTRL+H   F Describes a function.

G. Case Change Keys

Sometimes, you need to change cases to UPPERCASE or lowercase. To do that the following Keybindings can be used:

Serial No. Shortcut Keys Functions
1. ALT+U UPPERCASE word.
2. ALT+L lowercase word.
3. ALT+C Capitalize word.

H. Spelling Check Keys

You can check your text spelling by using the following Keybindings:

Serial No. Shortcut Keys Functions
1. ALT+$ Checks the spelling of the current word.
2. ALT+X   ispell-region Checks the spelling of all words in the region.
3. ALT+X   ispell-buffer Checks the spelling of the entire buffer.

I. Shell Keys

You can use the shell commands in Emacs as well. For that use the following Keybindings:

Serial No. Shortcut Keys Functions
1. ALT+! Executes a shell command.
2. ALT+| Runs a shell command on the region.
3. CTRL+U   ALT+| Filters region through a shell command.

J. Keyboard Macros Keys

You can create a keyboard macro using Keybindings as well. To do that use the following Keybindings:

Serial No. Shortcut Keys Functions
1. CTRL+X   ( Starts defining a keyboard macro.
2. CTRL+X   ) Ends Keyboard definition.
3. CTRL+X   E Executes the last defined keyboard macro.

Comparison of Emacs with Other Text Editors in Linux

There are many Text editors available and many of them provide specific advantages over Emacs in Linux. But Emacs also has other advantages and flexibility. So, you just need to use them to find your own cup of tea.

A. Emacs vs Vim in Linux

Vim is another popular text editor and people love it for its lightweight front. That’s because it was mainly developed from Vi. Vim stands for Vi IMproved. Vi was designed for slower Terminals and focused on the minimum number of keystrokes. Here are some comparisons between Emacs and Vim:

  • Editing Modes: Vim has 2 different editing modes. Command mode and Insert In command mode, you can type and execute commands. In Insert mode, you can add text to your file. But Emacs has content-aware mode. That means it doesn’t need any other modes. It understands the document type on its own.
  • Lightweight: Vim was mainly developed to work on slower Terminals. As a result, Vim is quite lightweight and easy to use. It doesn’t need many system resources. This is great for working in older systems. Emacs on the other hand may not be as light as Vim, but still lightweight compared to many other available text editors. Vim requires less RAM to run.
  • Learning Curve: Emacs has an easier learning curve for its easier and more natural interface compared to Vim. Vim on the other hand has different editing modes, making it harder for beginners to learn.
  • Customization: Emacs has more customization than Vim. You can use different programming languages to customize Emacs according to your needs. Vim also provides good enough customization capabilities. So, it’s not as large of a deal for most programmers or developers.

B. Emacs vs VS Code in Linux

VS Code is a modern text editor and a full-blown IDE. Presently, It is one of the most popular editors nowadays that many developers love to use for its intuitive interface. Here are some comparisons between Emacs and VS Code:

  • Lightweight: Emacs is more lightweight compared to VS Code. VS Code implements many functionalities and a complete IDE that may not run well on older systems. Additionally, It may take a lot of system resources. But Emacs is more optimized and can run on many systems quite easily regardless of the age of that system
  • Customization: Emacs is considered to be more customizable than VS Code. VS Code is not bad in any comparison, but in Emacs, you have KeyBindings and Emacs Lisp codes to customize pretty much anything.
  • Navigation: Emacs can be used for file navigation and mail checking and many other things we do in our Operating system. But, VS Code has some limitations in that case. Yes, some level of communication in the file manager is possible, but not even close to what is possible with Emacs

C. Emacs vs Nano in Linux

Nano is a built-in simple text editor in Linux. It was built for simplicity so that pretty much anyone can start using it with little to no knowledge beforehand. But, to do that it also had to sacrifice some functionality. Here are some comparisons between Nano and Emacs:

  • Simplicity: Nano is very simple. As a result, there is pretty much no learning curve. As a result, there are simple shortcuts displayed at the bottom and that’s it. So, beginners will need less time to get used to Nano.
  • Features: As Nano was built for simplicity, it had to sacrifice many functionalities as well. So, It doesn’t have many features to compete against a well-rounded text editor like Emacs.
  • Customization: Nano doesn’t have many customizations. Its main use can be editing some config files or doing some small edits to a text file. But, for any type of coding and development, Nano is simply not as powerful and its customization capabilities are also very limited.

Conclusion

Emacs in Linux is a popular text editor and many professionals use it as a daily driver. Certainly, it has immense functionality over other text editors or IDEs and has more customization than many heavy IDEs as well. Besides, It has a lot of Keybindings and they can improve functionality as well. But, that doesn’t mean you need to memorize all of them. Just try it out and practice. You will get used to it and love it after the steep learning curve.

People Also Ask

How is Emacs used in Linux?

Emacs is used as a text editor and much more. It is a popular choice for programmers, especially for Lisp languages like Clojure. Along with that, it can also be used for simple writing notes, emails to complex documents with tables, figures, and equations. Moreover, emacs can be used for basic web browsing with packages like EWW or W3M.

Why is Emacs important?

Emacs is considered important for several reasons. Some of these are:

  • Highly extensible and customizable.
  • Works beyond as a text editor. It can function as a code editor, integrated development environment (IDE), task manager, note-taking tool (Org Mode), email client (Gnus), and more.
  • Provides advanced text editing features such as syntax highlighting, auto-indentation, search and replace with regular expressions, etc.
  • Relies on keyboard shortcuts for most operations, providing a fast and efficient way to navigate and perform tasks.
  • Emacs Lisp, the programming language used for Emacs customization, allows users to treat code as data and data as code.

What is the Emacs command?

The Emacs command to launch the Emacs text editor from the command line is simply: emacs. When you run this command in a terminal, it starts Emacs, and you will be presented with the Emacs interface where you can begin editing text. Additionally, you can specify a file as an argument to open that file directly in Emacs by: emacs filename.

Is Emacs a terminal?

No, Emacs is not a terminal itself, rather, it is a text editor that can run in both terminal (text-based) and graphical (GUI) environments. The mode in which Emacs runs depends on how it is invoked.

Can Emacs run code?

Yes, Emacs can run code, and it can function as a powerful Integrated Development Environment (IDE) for various programming languages.

How to install the Emacs text editor in Linux?

To install the emacs text editor in Linux, for example, in your Ubuntu system, open the terminal and type the command sudo apt install emacs. Upon running the command, APT will download and install the emacs package and its dependencies making the text editor available to use in your Ubuntu system. In addition, if you are using a Red Hat-based Linux distro such as CentOS or Fedora you can run the command sudo yum install emacs.

What are keyboard bindings in Emacs?

The keyboard bindings refer to the association between key combinations and specific commands or functions within the emacs text editor. By default, the keybindings revolve around CTRL and ALT keys mostly. In addition, some keyboard bindings are subject to several key presses. It is pivotal in elevating the emacs user experience by allowing users to navigate, edit, and manipulate texts efficiently as per their preference within the emacs environment.

How to check if my system has Emacs installed in Linux?

To check if your Linux system has the emacs text editor installed or not, you can run the command emacs on the terminal. The editor will start with the default welcome message if the emacs is already installed in the system. Nor it will return an error message.

Rate this post
LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now
icon linux
Md. Rafsan Zani

Hello, I’m Md. Rafsan Zani. I have recently completed my Undergraduate from the Bangladesh University of Engineering and Technology (BUET). Currently, I’m pursuing higher studies abroad. I’m really interested in computer science and would like to learn a lot about the wonderful world of computers. Currently, I’m working as a Linux Content Developer Executive and find Linux really interesting. I certainly would like to learn more about Linux and implement them in my future studies. Read Full Bio

Leave a Comment