Whether you're SSH’d into a remote server or writing code in a local terminal, Vim is a skill every Linux user needs under their belt. Known as Visual Improved, Vim is the upgraded version of the classic Vi editor and it’s still a favorite in sysadmin, DevOps, SRE, and security workflows.

It’s fast, it’s powerful, and yes, it can be intimidating at first. But with just a few basics, you’ll go from guessing to gliding through your terminal.

Table of Contents

What Is Vim and Why Should You Care?

Vim (Visual Improved) is a highly configurable text editor built to make text editing more efficient. It’s widely available on Unix-based systems and thrives in environments where lightweight, fast editing is essential—like managing infrastructure, writing scripts, or editing config files over SSH.

It supports:

  • Syntax highlighting

  • Search & replace

  • Undo/redo

Launching Vim and Understanding Modes

To open a file using Vim:

vim filename.txt

Or create/open a file in a specific path:

vim /doc.txt

Vim operates using 3 modes:

  • Command Mode – Default mode when you open Vim. You can navigate, delete, or copy here.

  • Insert Mode – Where you can type text (i to enter, Esc to exit).

  • Extended Mode – Used for saving, quitting, or more advanced actions (Shift + :).

Essential Vim Shortcuts and Commands

Here's a handy list of commands to help you navigate like a pro:

  • Save & Quit:

wq → Save and quit

q! → Quit without saving

  • Copy:

yy → Copy the current line

yw → Copy the current word

nyy → Copy multiple lines

  • Delete:

dd → Delete the current line

dw → Delete the current word

ndd → Delete a specified number of lines

  • Navigation:

gg → Go to top of file

G → Go to bottom of file

nG or ngg → Go to line number n

  • Other Essentials:

p → Paste

u → Undo

Ctrl + r → Redo

  • Line Numbers:

set nu → Enable line numbers

set nonu → Disable line numbers

Real-World Use Cases of Vim

  • Remote Server Edits: Quickly edit config files over SSH without a full IDE.

  • Ansible & Terraform: Edit playbooks, templates, and .tf files in terminal-only environments.

  • Scripting and Automation: Create, modify, and debug bash scripts directly in the shell.

Final Thoughts

Vim might feel like a steep climb at first, but it pays off massively in speed, control, and efficiency. Whether you're editing YAML configs, pushing code on a cloud server, or writing quick documentation, mastering Vim will give you confidence in any Linux terminal.