To prepare for the Certified Kubernetes Administrator (CKA) exam, basic Linux skills are a necessity. Being able to move the cursor around quickly in the Bash shell and Vim, create aliases and handy environment variables helps saving precious time during the CKA exam.

Of course there are plenty of cheat sheets around, but creating one yourself that has the commands you like and use, forces you to learn them. I started this series to have cheat sheets of my own that have the generic commands, but also the specific ones for my Windows and MacOS devices if any.

While I was progressing it made sense to share my preparations, so hopefully it serves you well. If so, please like the series at the bottom.

The CKA prep series

Part 1 – Bash cheat sheet

Part 2 – Vim cheat sheet

Part 3 – Kubectl time savings (in progress)


There is time to win during the exam for fast text editing in Vim. KubeAcademy created a nice lesson for that. To do so, a couple of config changes to the .vimrc file in your home directory can make a huge difference.

" Set shift width to 2 spaces.
" Set tab width to 2 columns.
set tabstop=2 softtabstop=2 shiftwidth=2
" Use space characters instead of tabs.
set expandtab
" Show line numbers.
set number ruler
" Extra convenience when navigation deep levels in YAML.
set autoindent smartindent
" Increase readability through syntax highlighting.
syntax enable
" Enable type file detection, load plugins and indent for detected type.
filetype plugin indent on 

Let’s move on to the common keystrokes one needs to know. According to Vim, a word can be a group of letters, numbers, and underscores. On the other hand, a token is anything separated by whitespace and can include punctuation.

(command mode)
Move the cursor back one characterhUse 5h for 5 chars
Move the cursor forward one characterlUse 5l for 5 chars
Move the cursor up one linekUse 5k for 5 lines
Move the cursor down one linejUse 5h for 5 lines
Move cursor to start of word or prev. wordbUse B for token instead of word
Move cursor to end of word or next wordwUse W for token instead of word
Move cursor to end of wordeUse E for token instead of word
Move cursor to start of line0
Move cursor to end of line$
Move cursors to first (non-blank) char^
Move cursor to top of filegg
Move cursor to end of fileG
Move cursor to specific line5GUse 5G or :5 to move to line 5
Navigating screens
(command mode)
Move cursor to top of screenH(High)
Move cursor to middle of screenM(Middle)
Move cursor to bottom of screenL(Low)
Move cursor forward one screenCTRL + f(Forward)
Move cursor forward half a screenCTRL + d
Move cursor back one screenCTRL + b(Back)
Move cursor back half a screenCTRL + u
(insert mode)
Insert textiInsert mode before the cursor
Exit text insertESCExit insert mode
(command mode)
Yank (copy) current lineyyUse 5yy for 5 lines
Delete (cut) current lineddUse 5dd for 5 lines
PastepAfter cursor
RedoCTRL + r(Redo)
(visual mode)
Select text in char modev
Select text in line modeV
Select text in block modeCTRL + v
Yank (copy) marked texty
Delete (cut( marked textd
Paste textp
Change to lowercaseu
Change to uppercaseU
(command mode)
Search next instance of word*
Search prev instance of word#
Search forward for pattern/patten
Search prev for pattern?pattern
Continue search in same directionn
Continue search in opp directionN
Save and exiting
(command mode)
Save file and continue:w
Save and quit:wq
Save to new and continue new:sav
Save to new and continue prev:w new_filename
Quit without saving:q!
Advanced editing
(command mode)
Paste text without indenting:set pastePrepare to insert copied text from website
Indent a text sectionV,
Select lines,
> (or)
Single (or multi) indent a whole section at once. Use 2> for multiple indents
Show hidden tabs:set listShows hidden tabs (as ^I) that can cause kubectl parsing errors
Replace hidden tabs:retabReplaces hidden tabs (as ^I) with spaces. Most used after “:set list”

Useful links

Vim Commands Cheat Sheet

A Great Vim Cheat Sheet

Vimrc Configuration Guide – How to Customize Your Vim Code Editor

KubeAcademy: How to Prepare for the CKA ExamLesson 4 – Editing YAML with Vim


Leave a Reply

Avatar placeholder

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