• About Us
  • Announce
  • Privacy Policy
  • Contact us
MasterTrend News
25 °c
Columbus
20 ° Sea
21 ° Wed
  • Home
    • BLOG
    • STORE
  • Tutorials
  • Hardware
  • Gaming
  • Mobiles
  • Security
  • Windows
  • AI
  • Software
  • Networks
  • News
  • English English
    • Spanish Spanish
    • Portuguese Portuguese
    • French French
    • Italian Italian
    • German German
    • Korean Korean
    • Japanese Japanese
    • Chinese Chinese
    • Russian Russian
    • Thai Thai
    • Polish Polish
    • Turkish Turkish
    • Indonesian Indonesian
    • Hindi Hindi
    • Arabic Arabic
    • Swedish Swedish
    • Dutch Dutch
No result
See all results
  • Home
    • BLOG
    • STORE
  • Tutorials
  • Hardware
  • Gaming
  • Mobiles
  • Security
  • Windows
  • AI
  • Software
  • Networks
  • News
  • English English
    • Spanish Spanish
    • Portuguese Portuguese
    • French French
    • Italian Italian
    • German German
    • Korean Korean
    • Japanese Japanese
    • Chinese Chinese
    • Russian Russian
    • Thai Thai
    • Polish Polish
    • Turkish Turkish
    • Indonesian Indonesian
    • Hindi Hindi
    • Arabic Arabic
    • Swedish Swedish
    • Dutch Dutch
No result
See all results
MasterTrend News
No result
See all results
Start Tutorials

Vi Editor: The Linux Trick Few Know About! Discover It! 🔥

MasterTrend Insights by MasterTrend Insights
May 12, 2025
in Tutorials
Reading time:Lectura de 7 minutos
TO TO
0
11 Vim Tips That Will Save You Hours of Editing Time
3
SHARED
8
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
    1. Related Posts

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

You can save and exit vi from command mode. First, make sure you're in command mode by pressing the Escape key. (Pressing the Escape key again doesn't do anything if you're already in command mode.)

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:
56FacebookLinkedInPinterestXRedditTumblrBlueskyThreadsShare
56
SHARES

Related Posts

  • Caller ID for WhatsApp
  • How to fix the error Something went wrong on Twitter
  • AMD Radeon RX 6500 XT news
  • PS5 Pro Leaks
  • Avoid Old Files in Notepad Windows 11 🛡️ Find out how!
  • Wi-Fi 6 Version 2
  • Running an AI model on Xbox 360: Amazing 👾
  • How to Disable Hyper-V in Windows 11: 5 Easy Steps! 🚀
Tags: Evergreen ContentProductivityTechTips
Previous Post

Lucky Patcher Alternatives: 12 Better and Easy Apps! 🎮⚡

Next publication

Scientist in Atomfall: Save Him or Kill Him? 😱🎮

MasterTrend Insights

MasterTrend Insights

Our editorial team shares in-depth reviews, tutorials, and recommendations to help you get the most out of your digital devices and tools.

Next publication
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.4k Followers
  • 1.8k Subscribers

Don't miss the latest in technology and gaming.
Exclusive tips, how-to guides, and analysis every day.

Subscription Form
  • Tendencies
  • Comments
  • Last
How to add a clock to the Windows 11 desktop: 3 surefire tricks!

How to add a clock to your Windows 11 desktop: Get more done in minutes! ⏱️

May 1, 2025
12 Best Alternatives to Lucky Patcher for Android

Lucky Patcher Alternatives: 12 Better and Easy Apps! 🎮⚡

May 12, 2025
How to save game in REPO

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

July 7, 2025
How to use AdGuard DNS on Android in 2024

How to use AdGuard DNS on Android in 2025

February 11, 2025
Gmail Features on Android: Save Time with 5 Tips

Gmail Features on Android: 5 Tricks You Didn't Know About! 📱✨

12
Motherboard repair - Repair Motherboards

Notebook Motherboard Repair

10
Install Windows 11 Home without Internet

Install Windows 11 Home without Internet

10
How to Back Up Drivers in Windows 11/10 in 4 Steps!

How to Back Up Drivers in Windows 11/10: Avoid Errors! 🚨💾

10
iPhone Automatic Updates - A person holding an iPhone displaying the App Store Settings screen with the automatic app updates option enabled.

iPhone Automatic Updates: Avoid Errors! Act Now!

August 26, 2025
RustDesk controls any mobile phone in two steps: a person with a headset connects their phone to another smartphone for remote assistance and control.

Rustdesk: Free remote access to your mobile phone. Now! 🔒

August 24, 2025
Student Laptop 2025: Lightweight and thin laptop with near-edgeless display on an outdoor table, ideal for classes and homework.

Student Laptops 2025: 7 Models Tested Today ⚡️

August 23, 2025
Hidden Google Apps - Person with a magnifying glass discovering hidden Google apps; app icons popping out of a box with the logo, concept of features and tricks.

Hidden Google Apps: Gallery, Go, and PhotoScan 🚀

August 19, 2025

Recent News

iPhone Automatic Updates - A person holding an iPhone displaying the App Store Settings screen with the automatic app updates option enabled.

iPhone Automatic Updates: Avoid Errors! Act Now!

August 26, 2025
7
RustDesk controls any mobile phone in two steps: a person with a headset connects their phone to another smartphone for remote assistance and control.

Rustdesk: Free remote access to your mobile phone. Now! 🔒

August 24, 2025
21
Student Laptop 2025: Lightweight and thin laptop with near-edgeless display on an outdoor table, ideal for classes and homework.

Student Laptops 2025: 7 Models Tested Today ⚡️

August 23, 2025
24
Hidden Google Apps - Person with a magnifying glass discovering hidden Google apps; app icons popping out of a box with the logo, concept of features and tricks.

Hidden Google Apps: Gallery, Go, and PhotoScan 🚀

August 19, 2025
19
MasterTrend News logo

MasterTrend Info is your go-to source for technology: discover news, tutorials, and analysis on hardware, software, gaming, mobile devices, and artificial intelligence. Subscribe to our newsletter and don't miss any trends.

Follow us

Browse by Category

  • Gaming
  • Hardware
  • AI
  • Mobiles
  • News
  • Networks
  • Security
  • Software
  • Tutorials
  • Windows

Recent News

iPhone Automatic Updates - A person holding an iPhone displaying the App Store Settings screen with the automatic app updates option enabled.

iPhone Automatic Updates: Avoid Errors! Act Now!

August 26, 2025
RustDesk controls any mobile phone in two steps: a person with a headset connects their phone to another smartphone for remote assistance and control.

Rustdesk: Free remote access to your mobile phone. Now! 🔒

August 24, 2025
  • About Us
  • Announce
  • Privacy Policy
  • Contact us

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

Spanish Spanish
Spanish Spanish
English English
Portuguese Portuguese
French French
Italian Italian
Russian Russian
German German
Chinese Chinese
Korean Korean
Japanese Japanese
Thai Thai
Hindi Hindi
Arabic Arabic
Turkish Turkish
Polish Polish
Indonesian Indonesian
Dutch Dutch
Swedish Swedish
No result
See all results
  • English English
    • Spanish Spanish
    • Portuguese Portuguese
    • French French
    • Italian Italian
    • German German
    • Korean Korean
    • Japanese Japanese
    • Chinese Chinese
    • Russian Russian
    • Polish Polish
    • Indonesian Indonesian
    • Turkish Turkish
    • Hindi Hindi
    • Thai Thai
    • Arabic Arabic
    • Swedish Swedish
    • Dutch Dutch
  • Gaming
  • Hardware
  • AI
  • Mobiles
  • News
  • Networks
  • Security
  • Software
  • Tutorials
  • Windows

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

Comment Author Info
:wpds_smile::wpds_grin::wpds_wink::wpds_mrgreen::wpds_neutral::wpds_twisted::wpds_arrow::wpds_shock::wpds_unamused::wpds_cool::wpds_evil::wpds_oops::wpds_razz::wpds_roll::wpds_cry::wpds_eek::wpds_lol::wpds_mad::wpds_sad::wpds_exclamation::wpds_question::wpds_idea::wpds_hmm::wpds_beg::wpds_whew::wpds_chuckle::wpds_silly::wpds_envy::wpds_shutmouth:
wpDiscuz
RedditBlueskyXMastodonHacker News
Share this:
MastodonVKWhatsAppTelegramSMSHacker NewsLineMessenger
Your Mastodon Instance