iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
To edit a file in a server terminal, run vim filename, use i to start typing, then press Esc before saving or quitting. Vim opens in Normal mode, where keys are commands rather than text. This short guide covers the essentials for making a small change over SSH, even if your Vim experience is rusty.
How do you open a file with Vim on a server?
- At the server’s shell prompt, run
vim filename, replacingfilenamewith the path to the file you want to edit. Vim documents this as the common way to start editing one file from a terminal: Vim User Manual: Starting Vim. - If the command is unavailable, use an editor installed on that system or ask the administrator which editor is available. Do not assume every server has Vim.
Vim starts in Normal mode. In this mode, keys such as h and x perform actions; they do not insert those characters into the file. Press i to enter Insert mode and type text. Press Esc to return to Normal mode before issuing commands.
How do you move around and make a small edit?
In Normal mode, the basic movement keys are h (left), j (down), k (up), and l (right). The arrow keys also work in many Vim setups. Move the cursor to the intended spot, press i to insert before it, and type the change. Press Esc when you are done typing.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallFor a simple deletion, move to the character and press x. To undo the last change, press u; to redo an undone change, press Ctrl-r. These are enough to handle many small corrections without learning Vim’s broader command set.
#1 Best Overall
How do you save and quit Vim?
First press Esc to ensure you are in Normal mode. Type the command below and press Enter:
:wsaves the file and leaves Vim open.:qquits Vim if there are no unsaved changes.:wqsaves and quits.:q!quits without saving changes.
If Vim refuses to quit because the file has unsaved changes, decide whether to keep them: use :wq to save and exit, or :q! to discard the edits and exit. The exclamation mark in :q! overrides the unsaved-change warning, so use it only when you intend to lose those changes.
Where can you practice or look up Vim commands?
Vim’s own documentation offers three useful ways to continue. Its first-steps chapter is designed to provide enough to edit a file, though not yet well or fast, and covers insertion, movement, deletion, undo and redo, exiting, and help: The first steps in Vim.
Quick Recap
Best Value
Rank #3
- Look something up while working: type
:help topic, substituting a command or subject fortopic. Vim’s help is extensive, cross-referenced, and maintained with the software. Start with:helpif you are unsure what to search for. - Practice beginner commands: run Vim tutor from the shell, typically with
vimtutor. Vim’s help identifies it as a short interactive beginner course; official pages differ on its stated duration, so there is no single reliable time estimate. - Follow a guided manual: the Vim User Manual proceeds from simple tasks to more complex ones. Vim also provides a Reference Manual for precise details, with links between the two.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

