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.
# 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
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
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
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
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)
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.