Translate

New Live Courses

🚀 *Gen AI Engineer Telugu (Production Focused)*
🗓️ *Date:* 30th Sept 2026, 07:00AM IST
📝 *Register Now!:*
https://www.vlrt.in/gr
👥 *Join WA Community:*
https://www.vlrt.in/gw
💡*Course Content:*
https://www.vlrt.in/ai
▶️ *Demo Videos:*
https://www.vlrt.in/gv

🚀 *Service now Admin/ Development (ITSM)FREE Demo in Telugu*
🗓️ *Date:* 30th Sept 2026, 08:00AM IST
📝 *Register Now!:*
https://www.vlrt.in/7r
👥 *Join WA Community:*
https://www.vlrt.in/7w
💡*Course Content:*
https://www.vlrt.in/7c
▶️ *Demo Videos:*
https://www.vlrt.in/7v

🚀 *Vulnerability Management Training Demo*
🗓️ *Date:* 30th Sept 2026, 09:00 AM IST
📝*Register Now!:*
https://www.vlrt.in/vr
👥 *Join Community:*
https://www.vlrt.in/cw
💡 *Course Content:*
https://www.vlrt.in/vc
▶️ *Demo Videos:*
https://www.vlrt.in/Vm

Sunday, 19 November 2023

Using Text Editor vi

 


Vi is a powerful and versatile text editor that is widely used on Linux systems. It is known for its efficiency and flexibility, but it also has a steeper learning curve than some other text editors.

Basic vi commands:

  • Opening a file: To open a file in vi, use the following command:


Bash

vi filename

Replace "filename" with the name of the file you want to open.

  • Entering insert mode: To enter insert mode, press i. In insert mode, you can type text as you would in any other text editor. To exit insert mode, press Esc.

  • Moving around the file: To move around the file, use the arrow keys. You can also use the following commands:

  • h: Move one character left

  • j: Move one line down

  • k: Move one line up

  • l: Move one character right

  • w: Move one word forward

  • b: Move one word backward

  • Deleting text: To delete text, use the following commands:

  • x: Delete the character under the cursor

  • dd: Delete the current line

  • d$: Delete the rest of the line from the cursor to the end of the line

  • d^: Delete the rest of the line from the cursor to the beginning of the line

  • Copying and pasting text: To copy and paste text, use the following commands:

  • y: Copy the line under the cursor

  • p: Paste the last copied or cut text after the cursor

  • P: Paste the last copied or cut text before the cursor

  • Saving a file: To save a file in vi, press Esc to enter command mode, then type the following command:


Bash

:w

This will save the file to its current location. To save the file with a different name, type the following command:


Bash

:w filename

Replace "filename" with the name you want to save the file as.

  • Exiting vi: To exit vi, press Esc to enter command mode, then type the following command:


Bash

:q

This will exit vi without saving any changes. To exit vi and save any changes, type the following command:


Bash

:wq

Additional vi commands:

These are just a few of the many commands available in vi. For a complete list of commands, press Ctrl+K to open the vi help screen.

Conclusion:

Vi is a powerful and versatile text editor that can be a valuable tool for any Linux user. It is easy to learn the basics of vi, but it can take some time to master all of its features. With a little practice, you will be able to use vi to edit text files efficiently and effectively on your Linux system.


No comments:

Post a Comment

Note: only a member of this blog may post a comment.