Linux Apps & tools

vim/nano essentials for server admin

Practical Linux guide: vim/nano essentials for server admin without the usual guesswork.

10 min read Beginner Updated 9 Jun 2026

Step-by-step guide

Work through each section in order. Stop when your issue is resolved — you do not need every step for every situation.

What you will achieve

Edit config files over SSH with nano (friendly) or vim (everywhere) — cut, paste, search, and save without panicking.

1) nano essentials

  • Ctrl+O — save, Ctrl+X — exit.
  • Ctrl+W — search, Ctrl+\ — search-replace.
  • sudo nano /etc/ssh/sshd_config — always use sudo for system files.

2) vim modes

  • Normal — navigate; i insert, Esc back.
  • :w save, :q quit, :wq save and quit, :q! discard.
  • /pattern search, n next match.

3) vim safer defaults (optional ~/.vimrc)

set number
set relativenumber
syntax on
set tabstop=4 shiftwidth=4 expandtab

4) When to use which

Debian/Ubuntu minimal images often ship nano as default EDITOR. vim-tiny is still installed. Set update-alternatives --config editor if you prefer one.

Verify

echo $EDITOR
which vim nano

5) vim visual mode

v select characters, V line, Ctrl+v block. y yank, p paste, d delete.

6) nano line numbers and soft wrap

nano -l -S file.conf

7) Open at line (logs)

vim +500 /var/log/syslog
nano +500 /var/log/syslog

Remote editing

Prefer local edit + scp over raw vim over high-latency SSH if connection drops mid-save corrupt files. scp user@host:/etc/nginx/nginx.conf . — edit — push back.

8) sudoedit safer than sudo vim

sudoedit /etc/ssh/sshd_config

Copies to temp file — reduces risk of world-readable root edits in /tmp.

Prerequisites

SSH terminal access. sudo for /etc files. Basic keyboard familiarity. Optional: default editor set via update-alternatives --config editor.

Binary file trap

vim on binary spews garbage — use file command before editing unknown paths. -R for read-only view of logs without accidental modifies.

vim :set paste

Before pasting indented code from clipboard, :set paste prevents auto-indent mangling — toggle off after paste.

vim recording macros

qa start recording to register a, perform edits, q stop — @a replay. Useful for repetitive log line transforms faster than sed for one-off tasks over SSH.

view mode for logs

vim -R /var/log/syslog
 less +F /var/log/syslog

less +F tails like tail -f — often faster than opening huge logs in nano without line wrap misery.

nano -B backup

nano creates filename~ backup on save — recover botched sudoedit session from /etc/ssh/sshd_config~ if you saved wrong content.

vim line numbers jump

:123 jumps line 123 — error log pointed to line in config — faster than scrolling in 2000 line nginx.conf.

nano multibuffer

Ctrl+X then select Another File without closing — quick compare two small config snippets side by side in nano though vim diff is richer.

Related guides

essentials linux nano vim