• About Us
  • Announce
  • Privacy Policy
  • Contact us
MasterTrend News
  • HOME
    • BLOG
  • Tutorials
  • Hardware
  • Gaming
  • Mobile
  • Security
  • Windows
  • IA
  • Software
  • Networks
  • What's new
  • en_USEnglish
    • es_ESSpanish
    • pt_BRPortuguese
    • fr_FRFrench
    • it_ITItalian
    • de_DEGerman
    • ko_KRKorean
    • jaJapanese
    • zh_CNChinese
    • ru_RURussian
    • thThai
    • pl_PLPolish
    • tr_TRTurkish
    • id_IDIndonesian
    • hi_INHindi
    • arArabic
    • sv_SESwedish
    • nl_NLDutch
No result
See all results
  • HOME
    • BLOG
  • Tutorials
  • Hardware
  • Gaming
  • Mobile
  • Security
  • Windows
  • IA
  • Software
  • Networks
  • What's new
  • en_USEnglish
    • es_ESSpanish
    • pt_BRPortuguese
    • fr_FRFrench
    • it_ITItalian
    • de_DEGerman
    • ko_KRKorean
    • jaJapanese
    • zh_CNChinese
    • ru_RURussian
    • thThai
    • pl_PLPolish
    • tr_TRTurkish
    • id_IDIndonesian
    • hi_INHindi
    • arArabic
    • sv_SESwedish
    • nl_NLDutch
No result
See all results
MasterTrend News
No result
See all results
Start Tutorials

Editor Vi: The Linux trick few people know! Discover it! 🔥

MasterTrend Insights by MasterTrend Insights
May 12, 2025
in Tutorials
Reading time:6 min read
To To
0
11 Vim tips that will save you hours of editing time
10
SHARED
28
Views
Share on FacebookShare on Twitter

Contents

  1. Vi Editor: Master it in 3 easy, stress-free steps! 🚀
  2. Getting Started with Vi
  3. Command Mode
  4. Insertion Mode
  5. Save and Exit

Vi Editor: Master it in 3 easy, stress-free steps! 🚀

Vi is a powerful text editor that comes included with most Linux systems, even embedded ones. Sometimes, you'll need to edit a text file on a system that doesn't have a more user-friendly text editor, so knowing Vi is key. ✍️

Unlike Nano, a simpler terminal-based text editor, Vi doesn't hand you a list of on-screen keyboard shortcuts. It's a modal text editor, meaning it has both an insert mode and a command mode.

Getting Started with Vi

Vi is a terminal application, so you'll need to launch it from a terminal window. Use the command I saw /path/to/file to open an existing file with Vi. The command I saw /path/to/file also works if the file doesn't exist yet; Vi will create a new file and save it to the specified location when you're done. 💾

Ubuntu terminal with the vi command being used to open a new file.

Remember use sudo if you want to edit a file of the system. So, for example, you would have to write sudo vi /etc/fstab if you want to edit your fstab file.

Command Mode

This is what you'll see when you open a file in vi. It looks like you can only start typing, but that's not the case. Vi is a modal text editor, and it opens in command mode. Trying to type in this screen will give you unexpected behavior. ⚠️

A file opened in the vi text editor in an Ubuntu terminal window.

While in command mode, you can move the cursor with the arrow keys. Press the key x to delete the character under the cursor. There are several other commands for deleting; for example, typing dd (press the d key twice) deletes an entire line of text. 🗑️

You can select, copy, cut, and paste text in command mode. Place the cursor to the left or right of the text you want to select. you want to copy and press the key v. Move the cursor to select the text, and then press and to copy the selected text or x to cut it. Place the cursor in the desired location and press the key p to paste the text you copied or cut.

Selected text at the end of a file opened in the vi text editor.

Insertion Mode

Aside from command mode, the other mode you need to know about is insert mode, which allows you to insert text in Vi. Entering insert mode is easy once you know it exists: just press the key Yo once after you've positioned the cursor in command mode. Start typing and Vi will insert the characters you type into the file instead of trying to interpret them as commands. 📝

Vi text editor with text indicating that text was added by pressing the "i" key first.

Once you're done in insert mode, press the escape key to return to command mode.

Save and Exit

Puedes guardar y salir de vi desde el modo comando. Primero, asegúrate de estar en modo comando presionando la tecla Escape. (Al presionar la tecla Escape de nuevo no pasa nada si ya estás en modo comando.)

Writes :wq and press Enter to save the file to disk and exit vi. You can also split this command; for example, type :w and press enter to save the file to disk without exiting, or type :q to exit vi without saving the file.

Vi text editor with the "wq" command written at the bottom of the window.


Vi text editor with error stating "Cannot write since last change" at the bottom of the window.


If you're looking for a more user-friendly terminal text editor, check out Nano. Most Linux distributions come with Elder brother preinstalled, but embedded systems and other small environments often only include Vi. 🖥️

Share this:
56FacebookLinkedInPinterestXRedditTumblrBlueskyThreadsShareChatGPTClaudeGoogle AIGrok
56
SHARES
Tags: EvergreenContentProductivityTechtips
Previous Publication

Alternatives to Lucky this program: the 12 apps best and easy! 🎮⚡

next post

Scientist in Atomfall: Save him or kill him? 😱🎮

MasterTrend Insights

MasterTrend Insights

Our editorial team shares a deep-dive analysis, tutorials and recommendations for getting the most out of your devices and digital tools.

RelatedPublications

How to pair AirPods with a Chromebook: Person opens the AirPods case and connects them via Bluetooth to an HP laptop.
Tutorials

How to pair AirPods with Chromebook: Connect them in minutes! ⏱️🔌

November 20, 2025
69
RESULT_CODE_HUNG - Person using laptop with Chrome error "Aw, Snap!" (RESULT_CODE_HUNG), showing a 1-click solution that fixes Google Chrome and prevents it from freezing.
Tutorials

RESULT_CODE_HUNG: One-click solution that fixes Chrome 🚀

November 19, 2025
77
Rename PC in Windows 11: Settings screen showing "Change Computer Name", guide with 3 quick methods: CMD, PowerShell and Settings.
Tutorials

Rename your PC: done in 10 seconds, goodbye weird names 🔥

November 19, 2025
162
GIMP Stable Boy - User at a desk working in GIMP; screen shows GIMP Stable Boy plugin tutorial in Spanish for free generative fill-an open‑source Adobe alternative.
Tutorials

GIMP Stable Boy: Avoid Adobe and create magic for free 💥🚀

November 18, 2025
92
Disable autocorrect on iPhone: WhatsApp screen with keyboard open, steps to remove keyboard autocorrect on iOS.
Tutorials

Turn off autocorrect NOW: write freely in 1 min ⏱️🔥

November 6, 2025
79
Steam Damaged Update Files - How to fix the Steam error "damaged/corrupted update files"; Steam logo on dark background, step-by-step guide and solution.
Tutorials

Steam Corrupted Update Files: Fix in 2 min ⏳

November 6, 2025
93
next post
Should you help the Scientist in Atomfall?

Scientist in Atomfall: Save him or kill him? 😱🎮

5 2 votes
Article Rating
Subscribe
Access
Notify of
guest
guest
0 Comments
Oldest
Newest Most voted
Online Comments
See all comments

Stay Connected

  • 976 Fans
  • 118 Followers
  • 1.4 k Followers
  • 1.8 k Subscribers

Do not miss the latest in technology and gaming.
Tips unique, practical guides and analysis every day.

Subscription Form
  • Trends
  • Comments
  • Last
How to add clock on the Windows desktop 11: ¡3 tricks infallible!

How to add clock on the Windows desktop 11: Get more in minutes! ⏱️

1 May 2025
How to save game in REPO

How to save game in REPO 🔥 Discover the secret to not losing progress

7 July 2025
12 Best Alternatives to Lucky this program for Android

Alternatives to Lucky this program: the 12 apps best and easy! 🎮⚡

13 November 2025
🖥️ How to open 'Devices and printers' in Windows 11: 4 simple steps

🌟 How to open ‘Devices and printers’ in Windows 11: ¡Amazing trick!

November 20, 2025
Features of Gmail on Android: Save time with 5 tips

Features of Gmail in Android: you 5 tricks you did not know! 📱✨

12
Repair of motherboards - Repair MotherBoards

Repair of motherboards of Laptops

10
Install Windows 11 Home without Internet

Install Windows 11 Home without Internet

10
How to backup drivers in Windows 11/10 in 4 steps!

How to backup drivers in Windows 11/10 It Prevents errors! 🚨💾

10
Background App Refresh. A young woman in a classroom is showing on her iPhone the "Background App Refresh" option enabled in the app settings.

Background Update Activate it well and speed up your iPhone 🚀

November 23, 2025
Restart Windows Explorer - Woman restarting Windows Explorer from Task Manager in Windows to fix system errors in seconds.

Restart Windows Explorer: A Quick Trick That Saves Your PC ⚡

November 21, 2025
ASUS ROG Strix XG27ACMS 27-inch QHD gaming monitor with 320Hz refresh rate, shown on a gamer’s desk with an RGB keyboard and mouse displaying a high-definition cyberpunk scene.

ASUS ROG XG27ACMS, the fastest QHD, reveals its power 🚀

November 21, 2025
Wraithstones Nerathul - Image from Doom The Dark Ages showing the protagonist flying on a mechanical dragon towards a dark and stormy mountain, in the area where the Wraithstones are located, a guide to the location of all the Wraithstones in Doom The Dark Ages.

Wraithstones Nerathul: Easy Secrets to Obtaining Them ⚡

November 21, 2025

Recent News

Background App Refresh. A young woman in a classroom is showing on her iPhone the "Background App Refresh" option enabled in the app settings.

Background Update Activate it well and speed up your iPhone 🚀

November 23, 2025
56
Restart Windows Explorer - Woman restarting Windows Explorer from Task Manager in Windows to fix system errors in seconds.

Restart Windows Explorer: A Quick Trick That Saves Your PC ⚡

November 21, 2025
99
ASUS ROG Strix XG27ACMS 27-inch QHD gaming monitor with 320Hz refresh rate, shown on a gamer’s desk with an RGB keyboard and mouse displaying a high-definition cyberpunk scene.

ASUS ROG XG27ACMS, the fastest QHD, reveals its power 🚀

November 21, 2025
79
Wraithstones Nerathul - Image from Doom The Dark Ages showing the protagonist flying on a mechanical dragon towards a dark and stormy mountain, in the area where the Wraithstones are located, a guide to the location of all the Wraithstones in Doom The Dark Ages.

Wraithstones Nerathul: Easy Secrets to Obtaining Them ⚡

November 21, 2025
61
MasterTrend News logo

MasterTrend Info is your source of reference in technology: discover news, tutorials, and analysis of hardware, software, gaming, mobile, and artificial intelligence. Subscribe to our newsletter and don't miss any trend.

Follow us

Browse by Category

  • Gaming
  • Hardware
  • IA
  • Mobile
  • What's new
  • Networks
  • Security
  • Software
  • Tutorials
  • Windows
Add-as-a-preferred-source-on-Google

Recent News

Background App Refresh. A young woman in a classroom is showing on her iPhone the "Background App Refresh" option enabled in the app settings.

Background Update Activate it well and speed up your iPhone 🚀

November 23, 2025
Restart Windows Explorer - Woman restarting Windows Explorer from Task Manager in Windows to fix system errors in seconds.

Restart Windows Explorer: A Quick Trick That Saves Your PC ⚡

November 21, 2025
  • About Us
  • Announce
  • Privacy Policy
  • Contact us

Copyright © 2025 https://mastertrend.info/ - All rights reserved. All trademarks are property of their respective owners.

We've detected you might be speaking a different language. Do you want to change to:
es_ES Spanish
es_ES Spanish
en_US English
pt_BR Portuguese
fr_FR French
it_IT Italian
ru_RU Russian
de_DE German
zh_CN Chinese
ko_KR Korean
ja Japanese
th Thai
hi_IN Hindi
ar Arabic
tr_TR Turkish
pl_PL Polish
id_ID Indonesian
nl_NL Dutch
sv_SE Swedish
Change Language
Close and do not switch language
No result
See all results
  • en_USEnglish
    • es_ESSpanish
    • pt_BRPortuguese
    • fr_FRFrench
    • it_ITItalian
    • de_DEGerman
    • ko_KRKorean
    • jaJapanese
    • zh_CNChinese
    • ru_RURussian
    • pl_PLPolish
    • id_IDIndonesian
    • tr_TRTurkish
    • hi_INHindi
    • thThai
    • arArabic
    • sv_SESwedish
    • nl_NLDutch
  • Gaming
  • Hardware
  • IA
  • Mobile
  • What's new
  • Networks
  • Security
  • Software
  • Tutorials
  • Windows

Copyright © 2025 https://mastertrend.info/ - All rights reserved. All trademarks are property of their respective owners.

wpDiscuz
RedditBlueskyXMastodonHacker News
Share this:
MastodonVKWhatsAppTelegramSMSLineMessengerFlipboardHacker NewsMixNextdoorPerplexityXingYummly
Your Mastodon Instance