• About Us
  • Announce
  • Privacy Policy
  • Contact us
MasterTrend News
  • Home
    • BLOG
    • TECHNICAL SERVICE
    • STORE
  • Tutorials
  • Hardware
  • Gaming
  • Mobiles
  • Security
  • Windows
  • AI
  • Software
  • Networks
  • News
No result
See all results
  • Home
    • BLOG
    • TECHNICAL SERVICE
    • STORE
  • Tutorials
  • Hardware
  • Gaming
  • Mobiles
  • Security
  • Windows
  • AI
  • Software
  • Networks
  • News
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
1
SHARED
3
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:
6FacebookLinkedInPinterestXRedditTumblrBlueskyThreadsShare
6
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
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 use AdGuard DNS on Android in 2024

How to use AdGuard DNS on Android in 2025

February 11, 2025
How to Store Items in Oblivion Remastered: 5 Tricks You Need to Know! 🗝️💼

How to store items in Oblivion Remastered without losing your loot 💎⚡

May 1, 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
Google Account: 3 Steps to Detect Hackers and Protect Yourself Today

Google Account: Is your login compromised? Find out now! 🔒👀

June 30, 2025
Microsoft Office Startup Boost 🚀 Open Word in 1 second!

Microsoft Office Startup Boost 🚀 Accelerate your productivity now

June 29, 2025
Assassins Creed Shadows Revolution

Assassin's Creed Shadows Revolutionizes: Redefines Stealth with Art and Precision 🎯✨

June 29, 2025
PNP_DETECTED_FATAL_ERROR Fix the BSOD in 5 steps

PNP_DETECTED_FATAL_ERROR: How to Avoid a Fatal Shutdown in Windows Now! ⚡🔧

June 29, 2025

Recent News

Google Account: 3 Steps to Detect Hackers and Protect Yourself Today

Google Account: Is your login compromised? Find out now! 🔒👀

June 30, 2025
3
Microsoft Office Startup Boost 🚀 Open Word in 1 second!

Microsoft Office Startup Boost 🚀 Accelerate your productivity now

June 29, 2025
3
Assassins Creed Shadows Revolution

Assassin's Creed Shadows Revolutionizes: Redefines Stealth with Art and Precision 🎯✨

June 29, 2025
4
PNP_DETECTED_FATAL_ERROR Fix the BSOD in 5 steps

PNP_DETECTED_FATAL_ERROR: How to Avoid a Fatal Shutdown in Windows Now! ⚡🔧

June 29, 2025
4
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

Google Account: 3 Steps to Detect Hackers and Protect Yourself Today

Google Account: Is your login compromised? Find out now! 🔒👀

June 30, 2025
Microsoft Office Startup Boost 🚀 Open Word in 1 second!

Microsoft Office Startup Boost 🚀 Accelerate your productivity now

June 29, 2025
  • About Us
  • Announce
  • Privacy Policy
  • Contact us

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

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
No result
See all results
  • 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