7 Best Linux Text Editors

August 8, 2024

Introduction

A text editor, or a code editor, is an application designed for coding and editing in HTML, CSS, JavaScript, PHP, and many other programming languages. Most editors offer features such as syntax highlighting, easy navigation, customizable interfaces, and search and replace options.

This article provides a review of the best Linux text editors.

Seven Best Linux Text Editors

Best Command-Line Linux Text Editors 

Command-line text editors are suitable for users who prefer terminal-based text editing. These editors are designed for programmers, system administrators, and users who often work in environments without a graphical user interface.

They are lightweight, which allows them to run efficiently on low-resource systems or remote servers via SSH. Additionally, they are often more reliable in unstable environments, as they are less prone to crashes and slowdowns than GUI-based editors. The following text elaborates on top command-line editors.

Vi/Vim

vim logo

Almost all Linux distributions, even older versions, have the Vi and Vim editors installed. Vim stands for Vi Improved, a modified and improved version of the old text editor. Here are the pros and cons of using Vim:

Pros

  • Has extensive features for text manipulation, including macros, multiple buffers, and search and replace.
  • Includes keyboard shortcuts and commands that enable rapid text editing.
  • It is lightweight and runs efficiently even on older or less powerful hardware.
  • Supports plugins and comes with a tutorial (invoked with the vimtutor command).
  • Supports automatic commands, digraph inputs (useful in programming), split and session screens, tabs, colored schemes (color-coded by function), and tagging.

Note: Learn about pre-installed themes and how to install new or configure custom ones in our guide to Vim color schemes.

Cons

  • Has a steep learning curve, which makes it difficult for beginners.
  • A modal editing system and an extensive set of commands are non-intuitive for new users.
  • Setting up and managing configurations is complex and time-consuming.
  • Requires initial setup and configuration.
Vim text editor

Note: If you're getting started with Vi/Vim, check out our Vim commands cheat sheet

Nano Editor

Logo Nano

Nano is a revision of an older editor called Pico and comes pre-loaded on most Linux installations. The tool is an ideal lightweight editor for beginners. It's a lot simpler to use than Vim, which makes it useful for quick configuration edits. The following are the pros and cons of using Nano:

Pros:

  • Comes preinstalled on many Linux distributions.
  • It is intuitive and easy to use.
  • Uses minimal system resources.
  • Supports GNU Autoconf, interactive search-and-replace, auto-indent, and spellcheck.
  • Offers easy-to-remember keyboard shortcuts are displayed at the bottom of the editor.

Cons:

  • Lacks advanced features found in editors like Vim or Emacs.
  • Offers limited customization options than more powerful editors.
  • Has minimal syntax highlighting support, which may be a drawback for developers.
  • Not ideal for large projects. Better suited for small tasks rather than managing large coding projects.
  • Navigating and editing via keyboard is slower and less efficient than more advanced editors.
nano text editor

Note: Learn how to edit lines in a text file without a text editor using the Linux sed command.

GNU Emacs

emacs logo

GNU Emacs is a powerful and highly customizable text editor for Linux professionals created by Richard Stallman, the founder of the GNU project. It is designed to be versatile and has a wide range of built-in functions.

Emacs is used both as a command-line text editor and a GUI text editor. This dual functionality makes it suitable for many different users and use cases. The following text presents Emacs's pros and cons:

Pros:

  • Highly customizable, allowing users to extend its functionality significantly.
  • Runs on various operating systems, including Linux, macOS, and Windows, providing a consistent experience across platforms.
  • Offers both command-line and GUI interfaces, catering to different user preferences.
  • Possesses content-aware editing modes.
  • Has extensive documentation, a tutorial, and language support.
  • Offers cross-compatibility with other GNU apps, including an organizer, mail app, calendar, and debugger.

Cons:

  • Has a complex interface and extensive functionality, which is overwhelming for new users.
  • Compared to other text editors, Emacs is more demanding on system resources.
  • Requires significant setup and configuration to tailor it to specific needs.
  • Managing and configuring Emacs can be complex and time-consuming.
text editor emacs

How to Install GNU Emacs on Linux

Install GNU Emacs on Debian-based distributions with the following commands:

sudo apt update
sudo apt install emacs
sudo apt install emacs terminal output

Install GNU Emasc on Red Hat-based distributions with:

sudo dnf check-update
sudo dnf install emacs

Note: On older Red Hat-based distributions, you can use yum or rpm to install a text editor.

Install GNU Emasc on Arch-based distributions with:

sudo pacman -Syu
sudo pacman -S emacs

Best GUI Linux Text Editors 

GUI text editors are applications designed for text editing that feature graphical elements like windows, icons, menus, and buttons. Unlike command-line text editors, they rely on visual interactions for user input and functionality. The following sections present the best GUI text editors for Linux.

Gedit

gedit text editor logo

Gedit is a text editor that comes with the GNOME desktop environment. The design emphasizes simplicity, so Gedit is a great editor for beginners. The following are the pros and cons of using Gedit:

Pros

  • Simplified interface.
  • Clipboard support.
  • Multilanguage spellchecking.
  • Undo/redo functionality.
  • Syntax highlighting for various languages (C, C++, Java, Python, etc).
  • Flexible plugin system.

Cons:

  • Compared to more advanced text editors, Gedit's features are relatively basic.
  • Slow when handling large files or complex documents.
  • Some advanced tools and features found in other text editors are missing, such as built-in terminal emulators or advanced debugging tools.
  • Although it can be installed on non-GNOME systems, its integration and performance are best within the GNOME desktop environment.
  • Users often need to install and manage multiple plugins to access advanced features.
Gedit text editor

How to Install Gedit on Linux

On older versions of Linux or versions without GNOME, it may not come preinstalled. Install Gedit on Debian-based distributions with the following command:

sudo apt update
sudo apt install gedit
sudo apt install gedit terminal output

Install Gedit on Red Hat-based distributions with:

sudo dnf check-update
sudo dnf install gedit

Install Gedit on Arch-based distributions with:

sudo pacman -Syu
sudo pacman -S gedit

Sublime Text

sublime text logo

Sublime Text is a cross-platform text editor known for its speed and responsiveness. It has an intuitive interface and extensive plugin support that make it popular among developers and writers for its flexibility and efficiency. The following text elaborates on the pros and cons of using Sublime:

Pros

  • Highly customizable, both in appearance and in functionality (using plugins).
  • Fast and efficient, even with large files.
  • Advanced features like multiple cursors, split editing, and powerful search and replace functionalities.
  • Available for Windows, macOS, and Linux, ensuring a consistent experience across different operating systems.
  • Distraction-free writing mode that helps users focus solely on their content by hiding interface elements.

Cons

  • A steep learning curve.
  • Not open-source and requires a license for continued use after an evaluation period.
  • No advanced features found in other editors. Requires plugins to extend functionality.
  • While generally efficient, it consumes significant resources with many plugins or large files.
Sublime text editor

How to Install Sublime Text on Linux

Sublime Text is not a default application on most Linux installations. Take the following steps to install it on Debian-based distributions:

1. Download the GPG key for the Sublime Text repository with the wget command and use sudo apt-key add to add it to the system's list of trusted keys:

wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
terminal output for wget command

2. Print the repository URL and pass it through the pipe to the tee command. Use the tee command to write this URL into a new file in the /etc/apt/sources.list.d/ directory. This file tells the package manager where to find Sublime Text packages:

echo "deb https://download.sublimetext.com/apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
echo "deb https://download.sublimetext.com/apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list terminal output

3. Update the package list:

sudo apt update

4. Install Sublime:

sudo apt install sublime-text
terminal output for sudo apt install sublime-text

Take the following steps to install Sublime on Red Hat-based distributions:

1. Install the GPG key:

sudo rpm -v --import https://download.sublimetext.com/sublimehq-rpm-pub.gpg

2. Set up the Yum repository with:

sudo yum-config-manager --add-repo https://download.sublimetext.com/rpm/stable/sublime-text.repo

3. Install Sublime Text:

sudo yum install sublime-text

Sublime Text is available in the Arch User Repository (AUR), so you can install it using an AUR helper like yay. Install Sublime Text on Arch-based distributions with:

sudo pacman -Syu
yay -S sublime-text

If you don't have yay installed, you can install it from the AUR first.

Geany

Geany IDE and text editor logo

Geany works as a text editor, but its primary function is to serve as an Integrated Development Environment (IDE). It is a lightweight GUI text editor with basic IDE features. The following are the Geany pros and cons:

Pros

  • Requires minimal resource usage, making it a fast and responsive editor even on lower-spec systems.
  • Supports various operating systems, including Linux, Windows, and macOS, ensuring consistency across different platforms.
  • Provides IDE-like features such as syntax highlighting, code completion, and a built-in terminal, making it suitable for programming.
  • Supports plugins to extend its functionality, allowing users to add features as needed.

Cons

  • Lacks advanced debugging tools and integrated version control systems.
  • Doesn't offer as extensive customization options as some other editors or IDEs.
  • Has fewer built-in tools than more heavyweight IDEs, which might necessitate using additional software for certain tasks.
  • Offers basic file management features and might lack advanced options for handling multiple projects or large numbers of files.
Geany text editor

How to Install Geany on Linux

Install Geany on Debian-based distros with the following command:

sudo apt update
sudo apt install geany
sudo apt install geany terminal output

Install Geany on Red Hat-based distributions with:

sudo dnf check-update
sudo dnf install geany

Install Geany on Arch-based distributions with:

sudo pacman -Syu
sudo pacman -S geany

Kate

kate/kwrite logo

Kate is a powerful, multi-document text editor for KDE (K Desktop Environment) on Linux. It supports syntax highlighting, code folding, and multiple document editing, making it suitable for both programming and general text editing.

The KDE desktop isn't required to use Kate, and you can install it on Windows, Linux, and Mac.

The following are the pros and cons of using Kate:

Pros

  • Allows editing multiple documents at the same time.
  • Supports color-coded syntax, customization, and plugins.
  • Used to open and edit a single file quickly since the tool is lightweight.

Cons

  • Some users might find the extensive configuration options overwhelming or difficult to navigate.
  • Kate is primarily designed for Linux and may not be as readily available or fully functional on other operating systems.
  • For users who need only basic text editing features, Kate's advanced options might be excessive and complicate the workflow.
kate text editor

How to Install Kate on Linux

To install Kate on Debian-based distributions, use the following commands:

sudo apt update

sudo apt install kate

sudo apt install kate terminal output

To install Kate on Red Hat-based distributions, run the following commands:

sudo dnf check-update
sudo dnf install kate

Install Kate on Arch-based distributions with:

sudo pacman -Syu
sudo pacman -S kate

Conclusion

This guide provided an overview of major Linux text editors. Each tool has strengths and weaknesses, so this review should help you make an informed decision.

Next, learn more about Linux commands with this Linux commands cheat sheet.

Was this article helpful?
YesNo
Sara Zivanov
Sara Zivanov is a technical writer at phoenixNAP who is passionate about making high-tech concepts accessible to everyone. Her experience as a content writer and her background in Engineering and Project Management allows her to streamline complex processes and make them user-friendly through her content.
Next you should read
How to Install Vim 8.2 on CentOS 7
September 10, 2019

Official repositories struggle to keep pace with updates and new software versions. This article provides ...
Read more
How to Install and Use Nano Text Editor Commands in Linux
March 25, 2024

Nano is a simple, modeless, WYSIWYG command-line text editor included in most Linux installations. With ...
Read more
How to Save a File in Vi / Vim & Exit
September 22, 2022

Vim (Vi IMproved) is a well-known, open-source text editor for Linux or Unix systems. It is a powerful and ...
Read more
How To Install Vim 8.2 on Ubuntu 18.04
September 29, 2022

VIM, known as the programmer's editor, is highly configurable and customizable. Also, it allows syntax ...
Read more