
Editing files from the command line is something every Linux administrator does daily, whether it’s an SSH configuration, an Nginx virtual host, a cron job, or a systemd unit override.
Most servers don’t have a desktop at all, so when you connect over SSH, the terminal editor is the only way to change those files.
It’s worth knowing the basics of several editors, because you never know what will be installed on the next server you log into. At the same time, it pays to choose one editor and learn it properly, since the time you save on small edits adds up quickly over months of server work.
In this guide, we’ll cover seven command-line editors that Linux users rely on today, from long-standing classics to newer options built for modern workflows. For each one, we’ll look at what it’s good at, how to install it on Ubuntu and Rocky Linux, and the few keys you need to open, save, and quit a file.
1. Vi/Vim Editor
We’ll start with Vim (Vi IMproved), because it’s the editor you’re most likely to find on a server you didn’t set up yourself. Almost every Linux distribution ships at least a minimal vi, and on Rocky Linux and RHEL minimal installs, vi comes from the vim-minimal package, so it’s there even when nothing else is.
Vim is a modal editor, which means the keyboard behaves differently depending on the mode you’re in. In normal mode, keys move the cursor and run commands, and you only type text after switching to insert mode.
This takes some practice, but once it clicks, you can edit files very quickly without reaching for the mouse or arrow keys.
Vim is extremely flexible once you learn its commands. You can move between words, lines, and paragraphs with single keys, record macros to repeat an edit across many lines, and use regular expressions to replace text across a whole file.
For example, the following command, typed in normal mode, changes every occurrence of port 8080 to 8081 in the open file:
:%s/8080/8081/g
The minimal vi is enough for quick edits, but the full Vim package adds syntax highlighting, undo history, and plugin support, so it’s worth installing on servers you manage regularly.
On Ubuntu and Debian, install the full vim package with apt:
sudo apt update sudo apt install vim
On Rocky Linux, AlmaLinux, and RHEL, the full editor is packaged as vim-enhanced, since vim-minimal only provides the basic vi command:
sudo dnf install vim-enhanced
The part that confuses most beginners is getting out of Vim, so here are the keys you need. Open a file with vim filename, press i to start typing, and press Esc when you’re done to return to normal mode. Then type :wq and press Enter to save and quit, or :q! to quit without saving.
If Vim ever shows E325: ATTENTION Found a swap file when you open a file, it means a previous Vim session on that file was interrupted, usually by a dropped SSH connection, or someone else is editing it right now. Press R to recover your unsaved changes, or Q to quit and check who else is logged in before touching the file.
2. Nano Editor
If Vim feels like too much for a five-second change, GNU nano is the editor most people reach for next, because it’s simple and comes preinstalled on most of the Linux distributions.
Everything you type goes straight into the file, and the most common shortcuts are listed along the bottom of the screen, so you never have to remember them.
nano uses the ^ symbol to mean the Ctrl key, so ^O means Ctrl+O. Save the file with Ctrl+O, exit with Ctrl+X, search with Ctrl+W, and undo with Alt+U. A handy option when you’re following an error message that names a line number is to open the file directly at that line:
nano +42 /etc/nginx/nginx.conf
nano is already installed on Ubuntu and Debian, but you can make sure it’s present and up to date with apt:
sudo apt install nano
Rocky Linux, AlmaLinux, and RHEL minimal installs don’t include nano, so install it from the BaseOS repository with dnf:
sudo dnf install nano
nano doesn’t handle large projects or multi-file editing well, but for changing one setting in /etc/ssh/sshd_config and restarting the service, it’s hard to beat.
3. Neovim
Once you’re comfortable with Vim, you may start wanting features from modern code editors, such as completion, error checking, and smarter syntax highlighting. Neovim is a fork of Vim that adds these while keeping the same keys, so everything you learned in the Vim section still works.
The biggest difference is under the hood. Neovim includes a built-in client for the Language Server Protocol (LSP), a standard way for editors to talk to language-specific tools that provide code completion and error checking, uses Tree-sitter (a parsing library that understands code structure) for more accurate highlighting, and is configured in Lua through the ~/.config/nvim/init.lua file instead of Vimscript.
This is why Neovim has become the base for popular ready-made setups such as LazyVim, which turn it into a full development environment.
On Ubuntu and Debian, Neovim is available from the default repositories:
sudo apt update sudo apt install neovim
On Rocky Linux, AlmaLinux, and RHEL, Neovim comes from the EPEL (Extra Packages for Enterprise Linux) repository, which needs the CRB (CodeReady Builder) repository enabled first because many EPEL packages depend on its libraries:
sudo dnf config-manager --set-enabled crb sudo dnf install epel-release sudo dnf install neovim
Distribution packages often lag behind the current stable release, which is the 0.12 series at the time of writing. Many plugins and distributions such as LazyVim require a recent version, so if your package is too old, install the official release build into /opt instead:
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz sudo ln -s /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/nvim
Start Neovim with nvim filename. After installing plugins or language servers, run :checkhealth inside Neovim, which reports anything missing, such as a clipboard tool or a language server that isn’t in your PATH.
4. Micro Editor
Neovim rewards the time you put into learning it, but not everyone wants a modal editor. Micro takes the opposite approach to Vim and Neovim, and aims to be the editor that feels natural on the first day while still being comfortable for full-time use.
Micro uses the same shortcuts as most desktop applications, so Ctrl+S saves, Ctrl+Q quits, Ctrl+Z undoes, Ctrl+C and Ctrl+V copy and paste, and Ctrl+F searches.
It also supports the mouse for selecting text, has syntax highlighting for many languages, split panes, and a plugin system. Press Ctrl+E to open its command bar, where you can type commands such as set colorscheme simple to change settings.
On Ubuntu and Debian, Micro is in the default repositories:
sudo apt update sudo apt install micro
On Rocky Linux, AlmaLinux, and RHEL, the easiest route is the official install script, which downloads the latest prebuilt binary into the current directory. Since the binary has no dependencies, you only need to move it into your PATH afterwards:
curl https://getmic.ro | bash sudo mv micro /usr/local/bin/
The same script works on any distribution, which is useful when the packaged version is older than you’d like.
On a Linux desktop, Micro’s copy and paste talks to the system clipboard through xclip or xsel on X11, or wl-clipboard on Wayland. If copying from Micro doesn’t reach other applications, installing one of these tools usually fixes it.
5. Helix Editor
Micro keeps editing simple, while Helix goes in another direction. It’s a modal editor like Vim and Neovim, written in Rust, and designed to give you features such as LSP support, Tree-sitter highlighting, and a fuzzy file picker without installing or configuring any plugins.
The main difference from Vim is the order of commands. In Vim, you type the action first and then the movement, so dw means “delete a word“.
Helix reverses this, so you select first and then act: pressing w highlights the next word, and d deletes it. Because you always see the selection before anything changes, many users find mistakes easier to avoid.
Press the space bar in normal mode to open a menu that lists the most useful commands, and use :w and :q to save and quit, as in Vim.
On Debian 13 and newer, Helix is packaged under the name of its command:
sudo apt install hx
On Ubuntu, the Helix project publishes a .deb package on its GitHub releases page, and there is also a community-maintained PPA that the Helix documentation links to:
sudo add-apt-repository ppa:maveonair/helix-editor sudo apt update sudo apt install helix
On Fedora, Helix is in the default repositories, and the Helix documentation gives the same command for RHEL-based systems.
sudo dnf install helix
Once installed, start it with hx filename. On Arch Linux, the command is helix instead of hx, because another package already uses that name.
Helix includes support for the language servers, but it doesn’t install them for you. Run the following command to see which languages have a working language server on your system:
hx --health
The output lists each language with a tick or a cross next to its language server and formatter. A cross only means that server isn’t installed yet, so for shell scripts, for example, installing bash-language-server turns it into a tick.
6. Microsoft Edit
Helix is aimed at people who write code, while Microsoft Edit is aimed at the opposite end: users who are new to the terminal. Microsoft released it as open source in 2025, written in Rust, as a modern take on the classic MS-DOS Editor, mainly to give 64-bit Windows a built-in command-line editor.
It also runs on Linux, which makes it useful for people who move between Windows and Linux servers.
Edit has a menu bar that you open with the Alt key, full mouse support, and VS Code style shortcuts, so Ctrl+S saves, Ctrl+Q quits, and Ctrl+F finds text. It focuses on simple editing rather than programming features, so think of it as an alternative to nano rather than to Neovim.
Because the plain name edit clashes with existing commands on some systems, Linux packages usually install it as msedit. On Fedora, it’s available from the default repositories, and on Rocky Linux, AlmaLinux, and RHEL, it comes from EPEL once the CRB repository and epel-release are set up as shown in the Neovim section.
sudo dnf install msedit
Ubuntu doesn’t have an official package at the time of writing. so the quickest option is the community snap package, which is maintained outside Microsoft:
sudo snap install msedit
If you’d rather not use snaps, the project’s README provides an install script that builds Edit from source into ~/.local/bin, which needs Rust, a C compiler, and the ICU library installed first. Once installed, start it with msedit filename.
7. Emacs Editor
We’ll finish with GNU Emacs, which has been around since the 1970s and is the most extensible editor on this list. Emacs is built around its own programming language, Emacs Lisp, so almost every part of it can be changed.
Users run email, file management, Git workflows through Magit, and note-taking with Org mode, all inside Emacs.
Emacs uses Ctrl and Alt (called Meta in Emacs) key sequences. Save a file with Ctrl+X followed by Ctrl+S, and quit with Ctrl+X followed by Ctrl+C. If you prefer Vim’s keys, the Evil package adds a Vim-style modal mode on top of Emacs.
On servers, install the terminal-only build called emacs-nox, because the default emacs package pulls in graphical libraries that a headless server doesn’t need.
On Ubuntu and Debian, install it with apt:
sudo apt update sudo apt install emacs-nox
On Rocky Linux, AlmaLinux, and RHEL, install it with dnf:
sudo dnf install emacs-nox
Start Emacs inside the terminal with the -nw option, which stops it from opening a graphical window when a desktop is available:
emacs -nw filename
One feature that’s especially useful for sysadmins is TRAMP, which lets Emacs on your workstation edit files on a remote server over SSH, so you keep your own configuration without installing anything on the server. Press Ctrl+X Ctrl+F and open a path such as /ssh:[email protected]:/etc/hosts.
Emacs has the steepest learning curve on this list, but it also comes with a built-in tutorial. Press Ctrl+H followed by t to start it.
How to Choose a Command-Line Text Editor in Linux
Now that you’ve seen all seven editors, the easiest way to pick one is to look at the design choice that separates them, since it decides how comfortable you’ll feel in the first ten minutes.
Vim, Neovim, and Helix are modal editors, so they ask you to learn normal and insert mode first, but they repay that effort with very fast editing once the keys become habit.
nano, Micro, and Microsoft Edit are modeless editors, so whatever you type goes straight into the file and commands use key combinations such as Ctrl+S, which makes them a good choice for beginners and for quick changes to a single config file.
Emacs sits apart from both groups, because it’s modeless by default but is extended so heavily that many users treat it as a complete working environment rather than an editor.
Two practical questions also matter on servers. The first is whether the editor is already installed, because on a locked-down production machine you may not be allowed to install anything new, which usually leaves you with vi or nano.
The second is whether you need programming features such as code completion and error checking, in which case Neovim or Helix, with their built-in LSP support, are the better fit.
The following table brings the seven editors together so you can compare them at a glance:
| Editor | Command | Style | Installed by Default | Best For |
|---|---|---|---|---|
| Vim | vim / vi |
Modal | vi on most servers | Editing on any server |
| GNU nano | nano |
Modeless | Ubuntu, Debian | Quick config changes |
| Neovim | nvim |
Modal | No | Vim users who want LSP and Lua plugins |
| Micro | micro |
Modeless | No | Beginners who want modern shortcuts |
| Helix | hx |
Modal | No | Coding with LSP and no plugin setup |
| Microsoft Edit | msedit / edit |
Modeless | No | Users coming from Windows |
| GNU Emacs | emacs -nw |
Modeless (extensible) | No | A complete, customisable environment |
Tips for Using Command-Line Editors on Linux Servers
Whichever editor you settle on, a few habits will make it work better on real servers.
Many tools open an editor for you, including crontab -e, git commit, systemctl edit, and sudoedit, and they choose which one by reading the EDITOR and VISUAL environment variables. To make your favourite editor the default for your user, add both variables to ~/.bashrc and reload it:
echo 'export EDITOR=nvim VISUAL=nvim' >> ~/.bashrc source ~/.bashrc
On Ubuntu and Debian, you can also change the system-wide default editor for all users through the alternatives system, which shows a numbered list of installed editors to choose from:
sudo update-alternatives --config editor
When you edit system files, use sudoedit instead of sudo vim or sudo nvim. Running an editor as root means it runs with root’s permissions and root’s configuration, so any plugin you’ve installed also runs as root.
sudoedit copies the file to a temporary location, opens it in your editor as your normal user, and only writes it back with root permissions after you save:
sudoedit /etc/ssh/sshd_config
Finally, keep the basic vi keys in your memory even if you prefer another editor. On a minimal or broken server, such as one booted into rescue mode, vi is often the only editor available, and knowing i, Esc, :wq, and :q! is enough to fix a bad /etc/fstab entry and get the system booting again.
If the sudoedit tip changed how you edit root-owned files, share it with a colleague who still runs their entire plugin setup with sudo vim.
Conclusion
A terminal editor is one of the few tools you’ll use on every Linux server, so it’s worth choosing one deliberately. nano, Micro, and Microsoft Edit get you editing immediately, Vim works almost everywhere, Neovim and Helix bring modern coding features to the terminal, and Emacs can grow into a complete working environment.
If you’re new to Linux and want to build confidence with editors, the shell, and everyday administration tasks, our Learn Linux in 7 Days course is a good next step, since it walks through working on a real Linux system from the first login.
We’d love to hear which editor you use on your own servers. Do you stick with Vim everywhere, or have you moved to Neovim or Helix?
Is there a command-line editor we should add to this list? Feel free to share your favourite editor settings or any problems you’ve run into in the comments below.





