Fundamentals 8 min read

Master Essential vi Shortcuts to Boost Your Linux Productivity

This guide introduces the vi editor, explains its three operating modes, and provides a comprehensive list of essential shortcuts for navigation, editing, searching, undoing, and saving, helping embedded Linux developers work faster and more efficiently.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Essential vi Shortcuts to Boost Your Linux Productivity

vi Overview

vi is the standard full‑screen text editor on all Unix and Linux platforms. Vim is a fully compatible, feature‑rich enhancement of vi.

vi operates in three distinct modes:

Command mode : cursor movement, text deletion, copying, and switching to other modes.

Insert mode : text entry; press ESC to return to command mode.

Last‑line mode : used for saving, quitting, searching, and other ex‑commands.

Basic vi Operations

Enter vi with a file name: vi myfile Switch to insert mode: i – insert before the cursor a – append after the cursor o – open a new line below the current line

Return to command mode with ESC.

Save and quit commands (entered in last‑line mode): :w filename – write to

filename
:wq

– write and quit :q! – quit without saving

Cursor Movement

h

, j, k, l – left, down, up, right Ctrl+b – page up Ctrl+f – page down Ctrl+u – half‑page up Ctrl+d – half‑page down ^ – beginning of line w – next word start e – next word end b – previous word start #l – move to column # on the current line (e.g., 1l, 23l)

Navigation

:set nu

– show line numbers :set nonu – hide line numbers 0 – beginning of line $ – end of line H – top of screen M – middle of screen L – bottom of screen gg – first line of file G – last line of file n – move forward n characters n<Enter> – move down n lines nG – go to line

n

Deletion

x

– delete character under cursor #x – delete # characters forward (e.g., 6x) X – delete character before cursor #X – delete # characters backward dd – delete current line #dd – delete # lines starting from current line

Copying

yw

– yank from cursor to end of word #yw – yank # words yy – yank current line #yy – yank # lines starting from current line p – paste after cursor (must follow a yank command)

Search

/str

– search forward for

str
n

– repeat forward search ?str – search backward for

str
N

– repeat backward search * – search forward for the word under the cursor # – search backward for the word under the cursor

Undo/Redo

u

– undo Ctrl+r – redo . – repeat the last change

Saving and Quitting

:w

– write file :w! – force write :q – quit :q! – force quit without saving :wq – write and quit :wq! – force write and quit

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxtext editorViVimshortcuts
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.