Ubuntu CLI Editor Tutorial
Hands-on guide to the main terminal editors
Tested on Ubuntu Linux
Created: 2026‑03‑17
Editing Files from the Terminal Like a Pro

This page walks you through the main command‑line text editors available on Ubuntu Linux, with copy‑paste‑ready commands and the minimum keybindings you actually need to get work done.

nano vim neovim emacs
ubuntu@host: ~
ubuntu@host:~$ nano notes.txt
# quick edits
ubuntu@host:~$ vim config.yaml
# modal editing
ubuntu@host:~$ emacs -nw script.py
# full IDE in terminal

1. Overview of main CLI editors

Map the landscape

Ubuntu ships with nano by default, and makes it easy to install other editors like vim, neovim, and emacs. These tools run entirely inside your terminal and are essential for server work, scripting, and configuration.

nano
Beginner‑friendly, on‑screen shortcuts.
vim
Powerful modal editor, everywhere.
neovim
Modern vim with better defaults.
emacs
Full environment in terminal.

2. Installing the editors

Ubuntu apt
# Update package index
sudo apt update

# Install nano (usually installed)
sudo apt install nano

# Install vim
sudo apt install vim

# Install neovim
sudo apt install neovim

# Install terminal emacs
sudo apt install emacs-nox

3. nano – friendly default

Easy to learn

Opening files

nano myfile.txt
sudo nano /etc/hosts

Essential shortcuts

Ctrl + O — save
Ctrl + X — exit
Ctrl + W — search
Ctrl + K — cut line
Ctrl + U — paste line

Quick workflow

sudo nano /etc/ssh/sshd_config
# edit with arrow keys
# Ctrl + O, Enter to save
# Ctrl + X to exit

4. vim – modal editing

Server staple

Opening files

vim myscript.sh
sudo vim /etc/fstab

Minimal survival keys

i — insert mode
Esc — back to normal mode
:w — save
:q — quit
:wq — save & quit
:q! — quit without saving

Navigation

h j k l — left/down/up/right
0 — start of line
$ — end of line
gg — top of file
G — bottom of file
/text — search

Example workflow

vim app.conf
# press i, edit text
# press Esc
:wq   # save and quit

5. neovim – modern vim

vim, upgraded

Opening files

nvim main.py
nvim index.html style.css app.js

Same core keys as vim

i      # insert mode
Esc    # normal mode
:w     # save
:q     # quit
:wq    # save & quit
:q!    # quit without saving

Splits (quick taste)

:split otherfile.txt   # horizontal split
:vsplit otherfile.txt  # vertical split
Ctrl + w, arrow        # move between splits

6. emacs in the terminal

Full environment

Opening files

emacs -nw notes.org
sudo emacs -nw /etc/default/grub

Essential keybindings

Ctrl + x, Ctrl + s — save
Ctrl + x, Ctrl + c — exit
Ctrl + g — cancel command
Ctrl + f — forward
Ctrl + b — back
Ctrl + n — next line
Ctrl + p — previous line

Example workflow

emacs -nw README.md
# edit text
# Ctrl + x, Ctrl + s  (save)
# Ctrl + x, Ctrl + c  (exit)

7. Choosing the right editor

Practical guidance

You only need one primary editor to be effective. Learn nano for emergencies, then pick a “power editor” for daily work.

  • nano – obvious, safe, great for quick edits.
  • vim/neovim – ideal for servers and scripting.
  • emacs – if you want an all‑in‑one environment.