Pick a Terminal Editor: Vim or Nano?

You will, sooner or later, find yourself logged into a remote server over SSH with no GUI, needing to edit a config file. The two editors you will find on basically every Linux system are vim and nano. Pick one to learn well. Both have steep learning curves of different kinds: vim’s curve is hours of confusion followed by years of speed; nano’s curve is two minutes followed by quiet competence.

Nano: the pragmatic choice

Nano is a modeless editor. You open a file, you type, you save, you exit. The keyboard shortcuts are listed at the bottom of the screen at all times. There is no learning required.

The five commands you actually need

nano myfile.txt          # open or create file
# type to edit
# Ctrl+O   write (save) — confirm filename with Enter
# Ctrl+X   exit
# Ctrl+W   search
# Ctrl+K   cut current line
# Ctrl+U   paste

That is it. You can be productive in nano in 60 seconds.

When nano is the right choice

  • Quick edits over SSH on a server you do not maintain.
  • One-off config tweaks where you do not want to think about a tool.
  • Helping a non-technical person edit a file via screen-share — they can read the bottom of the screen.

Vim: the long-game choice

Vim is a modal editor — different keys do different things depending on which mode you are in. This is what makes it confusing at first and powerful later. The two main modes:

  • Normal mode (default) — keys are commands. j moves down, dd deletes a line, /word searches.
  • Insert mode — keys type characters. Press i from normal mode to enter insert mode. Press Esc to leave it.

The mental shift: in vim you spend most of your time in normal mode, treating editing as a series of commands. Insert mode is where you actually type new text. This sounds backwards. After a week it feels obvious.

The 20 commands that get you 80% of vim

# Open
vim myfile.txt           # open or create

# Modes
i        # enter insert mode (type to insert text)
Esc      # leave insert mode, back to normal
:        # enter command-line mode (for save/quit)

# Save / quit (from normal mode, after pressing Esc)
:w       # write (save)
:q       # quit
:wq      # save and quit
:q!      # quit WITHOUT saving (discard changes)

# Movement (in normal mode)
h j k l  # left, down, up, right
w        # next word
b        # back word
0        # start of line
$        # end of line
gg       # top of file
G        # bottom of file
:42      # jump to line 42

# Edit (in normal mode)
dd       # delete current line
yy       # yank (copy) current line
p        # paste
u        # undo
Ctrl+r   # redo
x        # delete one character

# Search
/word    # search forward for "word"
n        # next match
N        # previous match

Survive your first vim session

The most common panic: you opened a file, typed some characters, and now you do not know how to save or exit. Press Esc, then type :wq and hit Enter. To exit without saving anything: Esc, then :q!, Enter.

Why vim is worth the effort

Once vim’s commands feel automatic, you edit text faster than anyone using a mouse. You can move, delete, replace, and reformat code in fewer keystrokes than the equivalent VS Code action. You can also run vim on every Linux server you SSH to without installing anything.

Make your first .vimrc

Drop this in ~/.vimrc for sane defaults:

" basic sanity
syntax on
set number
set relativenumber
set tabstop=4 shiftwidth=4 expandtab
set ignorecase smartcase
set incsearch hlsearch
set mouse=a
set clipboard=unnamedplus

" stop arrow keys teaching you bad habits — optional
" map <Up> <Nop>
" map <Down> <Nop>

How to actually choose

Question Pick
“I just need to edit a config file every few weeks” Nano
“I will be at a terminal for hours every day” Vim
“I want to be a sysadmin / SRE” Learn both, master one (most pick vim)
“I work in security / pentesting” Vim — every shell you pop will have it
“I am scared of vim” Start with nano, graduate to vim later

The truth about both

You should know how to do at least the survival commands in vim, even if you use nano for everything else. Why? Because visudo, git rebase -i, and several other tools open vim by default. If your only knowledge is “Ctrl+X exits nano,” you will get stuck.

Survival vim, in case nothing else sticks:

Esc       # always start by pressing Esc to ensure you are in normal mode
:q!       # quit without saving (the safe escape hatch)
:wq       # save and quit (the normal exit)
i         # start typing
Esc       # stop typing

What to learn next

Whichever editor you picked, the next steps in the roadmap are about the shell itself: how it finds commands (PATH), how environment variables work, and how to chain commands together with pipes and redirects. That is where the command line stops being typing and starts being programming.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *