Skip to content

Text Editors

On a remote server there is no graphical interface. Editing a config file, writing a script, or fixing a mistake all happen in the terminal. vi or vim is guaranteed to be present on virtually every Unix system ever shipped, which makes it the one editor worth knowing even if you prefer something else for daily work. The others covered here are worth knowing about so you can make an informed choice for your own machine.

nano is the easiest terminal editor to get started with. It shows its own keyboard shortcuts at the bottom of the screen, so you do not need to memorize anything to use it. The ^ symbol in the menu means Ctrl.

Terminal window
nano /path/to/file.txt
ShortcutAction
Ctrl+OSave (write out)
Ctrl+XExit
Ctrl+KCut the current line
Ctrl+UPaste
Ctrl+WSearch
Ctrl+GHelp

nano’s limitation is that it is not present on all server images (minimal containers and Alpine-based images often omit it) and it has no modal editing, macros, or scripting. For a quick config file edit it is fine; for anything more, vim is the better investment.

vim is a modal editor: the same keys do different things depending on which mode you are in. This is disorienting at first but becomes fast once it is internalized, because your hands never leave the home row to reach for a mouse or arrow keys.

vim has four modes you will use regularly:

ModeHow to enterPurpose
NormalEsc (always)Navigation and commands. The mode vim starts in.
Inserti before cursor, a after, o new line below, O new line aboveTyping text
Visualv (character), V (full line)Selecting text to copy, delete, or indent
Command:Running named commands (save, quit, search-replace)
KeyAction
:wSave
:qQuit (fails if there are unsaved changes)
:wqSave and quit
:q!Quit without saving

These work in Normal mode. Reaching for arrow keys works too, but the home-row keys are faster once you build the habit.

KeyAction
h / j / k / lLeft / down / up / right
w / bJump forward / backward one word
0 / $Jump to start / end of the current line
gg / GJump to the first / last line of the file
Ctrl+d / Ctrl+uScroll half a page down / up
:42Jump to line 42
KeyAction
xDelete the character under the cursor
ddDelete (cut) the current line
[count]ddDelete [count] lines, starting with the current one
yyYank (copy) the current line
[count]yyYank [count] lines, starting with the current one
pPaste below the current line
uUndo
Ctrl+rRedo
=Auto-indent the current line or selection
gg=GAuto-indent the whole file

In Visual mode, select text first with v or V, then press d to delete or y to yank the selection.

Key / CommandAction
/textSearch forward for “text”
?textSearch backward
n / NJump to next / previous match
:%s/old/new/gReplace every occurrence of “old” with “new” in the file
:%s/old/new/gcSame, but ask for confirmation before each replacement
CommandWhat it does
:set numberShow line numbers
:set nonumberHide line numbers
:e filenameOpen another file in the current window
:syntax onEnable syntax highlighting

A few lines in ~/.vimrc can make vim significantly more livable without turning it into a full IDE. At minimum, set number and syntax on are worth adding.

Neovim is a modernized fork of vim with a Lua-based plugin system, a built-in LSP (Language Server Protocol) client for code completion and diagnostics, and better defaults out of the box. Every vim keybinding and command works unchanged in Neovim. The reason to be aware of it: much of the current vim plugin ecosystem targets Neovim specifically, and many online configurations assume it. It is not the right tool for a quick SSH session on an unfamiliar server, but it is a strong choice if you want vim as your primary editor on your own machine.

Emacs is built on a different philosophy from vim: rather than a text editor, it is a programmable environment (in Emacs Lisp) that happens to edit text. It uses chord shortcuts (Ctrl+x Ctrl+s to save, Ctrl+x Ctrl+c to quit) rather than modal editing, and it maintains a persistent session where buffers, terminal sessions, and file trees all coexist. It has a devoted following, particularly in Lisp and functional programming communities. It is not a practical starting point for a sysadmin learning terminal editors, but it is worth knowing what it is when you encounter it.

Helix is a modal editor like vim but with a selection-first model: you select text first, then act on it, rather than vim’s action-then-motion order. It ships with tree-sitter syntax highlighting and LSP support built in, with no plugin installation or configuration needed. Because it works well out of the box without any dotfiles, it is a practical choice for a sysadmin who wants something more capable than nano on a fresh server where their vim config is not available.

Helix is not installed by default on most systems, so you would need to install it yourself. Its key bindings are similar enough to vim that the concepts transfer, but different enough that the table below is worth consulting.

Key / CommandModeAction
iNormalInsert before selection
aNormalInsert after selection
o / ONormalOpen new line below / above
EscInsert / SelectReturn to Normal mode
vNormalEnter Select (visual) mode
xNormalSelect the current line (extend selection)
dNormal / SelectDelete selection
cNormal / SelectChange (delete selection and enter Insert mode)
yNormal / SelectYank (copy) selection
pNormalPaste after cursor
uNormalUndo
h / j / k / lNormalLeft / down / up / right
w / bNormalNext / previous word
gg / geNormalFirst / last line
/NormalSearch
n / NNormalNext / previous match
:wCommandSave
:qCommandQuit
SpaceNormalOpen command palette and file picker