vim is a text editor built directly into almost every Linux system. It lets you create and edit configuration files, scripts, and documentation from the command line without needing a graphical window. For the EX200 exam, you must prove you can use vim efficiently because real-world Linux servers rarely have a mouse or a pretty interface.
Jump to a section
A simple way to picture Editing Files with vim
The kitchen is the busiest room in a busy family home.
Imagine you are renovating your kitchen with a family member who has a very specific way of working. You cannot just grab a spoon and start stirring; you must first learn where everything lives. The vim editor works the same way. It has a 'normal mode' where you move around the kitchen without touching the food. You might inspect a spice jar by hovering over it, or you might cut a vegetable by pressing a key that combines 'delete' and 'insert' in one motion. When you need to add flour, you switch to 'insert mode' — it is like opening the cupboard and actually putting your hand inside. But if you try to type your recipe while the knife is still in your hand (staying in normal mode), you will accidentally delete the carrots.
The biggest difference from a regular text editor is that vim expects you to think before you type. It is like having a kitchen where every drawer has a label and every appliance has a single button that does something powerful, like 'c' to chop or 'x' to scrape the chopping board clean. You memorise those commands once, and then you can cook (or edit) at lightning speed without ever lifting your fingers from the home row. The initial confusion—feeling like you are locked out of your own kitchen—passes as soon as you learn that the mode switch is just the key to the door.
vim stands for 'Vi Improved'. Vi is an older text editor that was written for a time when computer terminals were slow and keyboards had no arrow keys. Every key on the keyboard had a job, and vim kept that philosophy but made it friendlier. When you open a file with vim (by typing 'vim filename.txt'), you land in 'normal mode'. This is the default mode. In normal mode, every key you press is a command. If you press 'j', the cursor moves down one line. If you press 'k', it moves up. The 'h' key moves left, and 'l' moves right. There are no arrow keys involved unless you decide to use them—but real vim users rarely do.
From normal mode, you can enter 'insert mode' by pressing 'i'. Now the keyboard behaves like a normal typewriter: you type letters and they appear in the file. When you finish typing, press the 'Escape' key (Esc) to return to normal mode. This back-and-forth is the core rhythm of vim. It feels odd at first because most editors let you type immediately. But the reason for the separation is efficiency. In normal mode you can move, delete, copy, paste, search, replace, and undo with just a few keystrokes.
Here are the most common vim commands you will use every day:
'i' — go to insert mode at the cursor position
'Esc' — return to normal mode
':w' — save the file (write)
':q' — quit vim
':wq' — save and quit
':q!' — quit without saving (force quit)
'x' — delete the character under the cursor
'dd' — delete the entire current line
'yy' — copy (yank) the current line
'p' — paste below the current line
'u' — undo the last change
'Ctrl+r' — redo the undone change
'/word' — search forward for 'word'
'?' — search backward
Notice that the colon (':') puts you into 'command-line mode', which is different from insert mode. In command-line mode, you type commands like 'w', 'q', or 'q!' and press Enter. After executing the command, you return to normal mode automatically.
Why does vim exist? Because when you manage dozens of servers remotely, you cannot rely on a graphical text editor. You connect to the server via SSH—a secure way to log in to a remote computer's terminal—and you need an editor that works entirely in text. vim is installed on every Linux distribution by default. It is lightweight, stable, and can handle files of any size. It also has syntax highlighting, so code and configuration files appear in colour, making them easier to read.
The key skill for EX200 is not memorising every command. It is knowing the handful of commands that let you open a file, make a change, save it, and close it without panic. The exam will put you in a terminal window and ask you to edit a configuration file. If you cannot start vim, move to the right line, change the value, and save the file, you fail that question. The reward for learning vim is speed. After a week of practice, you can edit files twice as fast as someone using a mouse-based editor because your fingers never leave the home row.
Open the file
Type 'vim filename.txt' in the terminal. The file opens in normal mode. If the file does not exist, vim creates a new empty file.
Move to the line you need to edit
Use 'j' to move down, 'k' to move up, 'h' left, 'l' right. To jump to a line number, type ':' followed by the number (e.g., ':5') and press Enter. This saves time over scrolling.
Enter insert mode to edit
Press 'i'. Now you can type, delete characters with Backspace, and use arrow keys normally. Every character you type appears in the file.
Make the change
Edit the text as needed. For example, change an IP address or a username. Use Backspace to delete incorrect text, then type the correct value.
Return to normal mode
Press the Esc key. This tells vim you are done typing. Now the keyboard is back to command mode. You must be in normal mode to save or quit.
Save and exit
Type ':wq' and press Enter. The colon enters command-line mode, 'w' tells vim to write (save) the file, and 'q' tells it to quit. After you press Enter, the file is saved and vim closes.
A junior system administrator at a mid-sized e-commerce company receives a ticket: 'The Nginx web server is returning a 502 Bad Gateway error. Check the configuration file at /etc/nginx/sites-available/default and update the proxy_pass directive to point to 10.0.0.5:8080.' The junior has never touched this server before. Here is what they do:
First, they SSH into the server: 'ssh admin@192.168.1.100'. Once connected, they open the configuration file with vim: 'vim /etc/nginx/sites-available/default'. The file appears in the terminal. The cursor is at the top-left. The junior is in normal mode.
They type '/proxy_pass' and press Enter. The cursor jumps directly to the line containing 'proxy_pass http://10.0.0.1:8080;'. They press 'i' to enter insert mode, delete the old IP address, and type the new one: '10.0.0.5'. Then they press Esc to return to normal mode. They type ':wq' and press Enter. The file is saved and vim closes.
Now they need to test the configuration. They run 'nginx -t' to check for syntax errors. If the test passes, they reload Nginx with 'systemctl reload nginx'. Finally, they test the website from their browser to confirm the 502 error is gone.
The vim session took maybe 15 seconds. If the junior had used a graphical editor, they would have needed to download the file, edit it, upload it back, and risk permissions problems. With vim, they edited the file live on the server.
In a production environment, you might also use vim to:
Edit firewall rules in /etc/iptables/rules.v4
Change SSH settings in /etc/ssh/sshd_config (like disabling root login)
Modify cron job schedules in /etc/crontab
Update application configuration files in /opt/app/config.yml
Write quick shell scripts to automate backups or log rotation
Every Linux administrator uses vim daily. It is not optional—it is expected. The EX200 exam tests the very skills this junior used: opening a file, searching for a line, editing it, saving, and closing. Everything else is decoration.
The EX200 exam requires you to demonstrate practical proficiency with vim, not theoretical knowledge. There will be no multiple-choice questions about vim modes. Instead, you will be given a scenario like: 'Edit the file /etc/hosts and change the IP address for host1 from 192.168.1.10 to 192.168.1.20.' You must perform the edit in vim, save it, and verify the change.
The exam loves to test: the difference between ':wq' and ':q'. Many students accidentally type ':w' and then ':q' separately, which works but wastes time. Others type ':q' after editing and lose all changes. The correct pattern is ':wq' (save and quit) or ':w' then ':q' (save first, then quit).
Another common trap: the colon-based commands like ':wq' are typed in normal mode, not insert mode. If you are in insert mode and type ':wq', the letters ':wq' will appear in the file itself. You must press Esc first.
The exam also tests 'wq!' — the force variant. The exclamation mark at the end (like ':wq!') forces the save even if the file is read-only or if there are warnings. This is often needed when editing system files that you have permission to modify but are flagged as protected.
Students frequently confuse 'ZZ' (save and quit using two capital Zs) with ':wq'. They do the same thing, but 'ZZ' works only if you hold Shift and press Z twice. The colon commands are more explicit and safer to use during the exam under pressure.
Key exam topics to memorise:
Normal mode vs insert mode vs command-line mode
How to switch modes: 'i' to insert, Esc to normal, ':' to command-line
How to save: ':w'
How to quit without saving: ':q!'
How to save and quit: ':wq'
How to undo: 'u'
How to redo: Ctrl+r
How to delete a line: 'dd'
How to delete 3 lines: '3dd'
How to copy a line: 'yy'
How to paste: 'p'
How to search: '/' followed by search term, then Enter
How to go to a specific line number: type ':5' to jump to line 5
Traps in exam questions:
The question may say 'edit the file using vi' — vi and vim are nearly identical for basic tasks, but the exam environment uses vim.
The question may give you a file that already has multiple incorrect lines. Read the file carefully before editing.
The question may ask you to 'append' text to the end of a line. Use 'A' (capital A) to go to the end of the line in insert mode, or use '$' to move the cursor to the end in normal mode and then 'i'.
The question may require you to insert text before the first character of a line. Use 'I' (capital I) to go to the beginning of the line in insert mode.
The only way to prepare is to practise. Open a test file on a Linux virtual machine and edit it repeatedly. Try to make a change every 10 seconds. The exam timer is relentless; speed counts.
vim has three main modes: normal mode (default, for commands), insert mode (for typing text), and command-line mode (for saving and quitting with colon commands).
Press 'i' to start typing, 'Esc' to stop typing and return to normal mode.
Type ':wq' to save the file and exit vim in one command.
Type ':q!' to exit without saving any changes.
Use 'dd' to delete the entire current line and 'yy' to copy it.
Use '/' followed by a word to search forward through the file.
The 'u' key undoes the last change; press Ctrl+r to redo.
You must press Esc before typing any colon command like ':w' or ':q'.
Every Linux server has vim installed—it is not optional for a system administrator.
Practice editing a test file repeatedly until the keystrokes feel automatic.
These come up on the exam all the time. Here's how to tell them apart.
Normal Mode
Default mode when vim starts
Keyboard keys are commands (j, k, dd, yy)
Cannot type text directly
Insert Mode
Entered by pressing i
Keyboard types text into the file
Cannot execute save or quit commands
:wq
Saves the file first
Then quits vim
Does not need exclamation mark unless file is read-only
:q!
Does not save the file
Forces vim to quit even if changes exist
Loses all unsaved edits permanently
dd (delete line)
Removes the entire line from the file
Stored in the paste buffer
Can be undone with u
yy (yank/copy line)
Copies the entire line to the paste buffer
Does not remove the line from the file
Used with p to paste the copied line
/search
Moves cursor to the first match of 'search'
Navigates to one match at a time
Does not change text automatically
:s/old/new/g
Replaces every instance of 'old' with 'new' in the whole file
Changes text permanently (until undo)
Requires a colon to enter command-line mode
Mistake
You must learn every vim command to pass EX200.
Correct
You only need about 10-15 commands to pass the EX200 vim questions: i, Esc, :w, :q, :wq, :q!, dd, yy, p, u, / (search), and navigation with h,j,k,l.
Beginners panic when they see the full vim manual—it is hundreds of pages long. The exam only tests basic editing. Overwhelm leads to procrastination.
Mistake
vim is broken because the arrow keys do not work.
Correct
Arrow keys do work in insert mode on modern vim, but in normal mode you should use h,j,k,l to keep your fingers on the home row. The arrow keys are slower.
New users press arrow keys in normal mode and sometimes the cursor does not move as expected when combined with other keys, making them think vim is defective.
Mistake
I can use nano instead of vim on the exam because it is easier.
Correct
The EX200 exam specifically tests vim (or vi). You will not get credit for using nano. Some questions may also require knowledge of vi, but vim is the default editor in RHEL.
Students come from Windows or GUI backgrounds and avoid vim because it feels hard. The exam rubric makes vim mandatory.
Mistake
If I type ':q' and my file closes, my changes are saved automatically.
Correct
':q' does not save changes. It only quits. If you have unsaved changes, vim will refuse to quit and show a warning. You must use ':wq' or ':w' then ':q' to save.
In many modern editors (like Notepad), closing the window prompts you to save. vim assumes you know what you are doing and does not ask for confirmation by default.
Mistake
vim is only for programmers.
Correct
vim is used by system administrators, DevOps engineers, and anyone who edits text on a server. It is not limited to code; it edits configuration files, logs, and documentation.
The stereotype of vim as a 'coder tool' scares non-programmers. Server configuration files are plain text, and vim handles them perfectly.
Mistake
Once you exit vim, you cannot undo your edits.
Correct
vim maintains an undo history as long as the file is open. After saving and quitting, the history is lost. If you want to revert after closing, you need version control (like git) or backups.
New users often expect an 'undo after close' feature, which is common in GUI editors that keep temporary backups.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
Type ':wq' and press Enter. This saves the file first, then quits. If you have already saved, you can also type ':q' to quit safely.
Press Esc to ensure you are in normal mode. Then type ':q!' and press Enter. This forces vim to quit without saving anything.
vim is 'Vi Improved'. It has more features like syntax highlighting, multi-level undo, and better help. For the EX200 exam, both work the same for basic editing tasks.
You are in normal mode. Press 'i' to switch to insert mode, then you can type. Press Esc to go back to normal mode when you are done.
Move the cursor to the line. Press 'yy' to copy (yank) the line. Then move the cursor to where you want the copied line to appear and press 'p' to paste it below the current line.
In normal mode, type '/' followed by the word you want to find, then press Enter. The cursor jumps to the first match. Press 'n' to go to the next match, or 'N' to go to the previous one.
You've finished Editing Files with vim. Continue through the EX200 study guide to build a complete picture of the exam.
Done with this chapter?