Learn how to open, edit and save files with vi and speed up command-line text work. 16.11.2025 | reading time: 2 min Open a terminal and ask yourself how to edit a quick config without a GUI; use vi and get it done fast. A quick real task Do this now: run `vi todo.txt`, press `i` to enter insert mode, type two lines like "Buy backup tapes" and "Update /etc/hosts", press `Esc`, then save and exit with `:wq`; verify with `cat todo.txt` to see the exact lines you added. Master the modes vi works by modes: Normal for commands, Insert to type, and Command-line for saving and more; practice by moving with `h j k l`, jumping words with `w` and `b`, and deleting with `x` or `dd` to learn muscle memory. Power edits and search Do a targeted replace with `:%s/old/new/g` to change every occurrence in the file, repeat a search with `n`, and yank & paste using `yy` and `p` to rearrange lines quickly in a larger file. When things go wrong If you accidentally entered many changes and want to quit without saving, type `:q!`; to inspect file differences use `:set number` to show line numbers then edit the lines you need, step by step. Other practical tricks Open multiple files with `vi file1 file2` and switch buffers with `:n` and `:prev`, run shell commands from vi with `:!ls` and save typing with macros using `q` followed by a register to record and replay actions. Complementary editors Try `vim` for extra features, `nano` for a gentler learning curve, and `sed` for scripted edits when you must automate changes across many files. Next steps Practice these commands daily on real config files and small scripts; mastery of vi will pay back in speed and confidence at the shell, and if you want to deepen Linux skills consider certifications like CompTIA Linux+ or LPIC-1 with intensive preparation at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. utilities scripting troubleshooting filesystem