Red Hat Linux Reference Guide

Linux Introduction

VI-EDITOR

Process Management

Linux Installation

Disk Partitions & File System Management

Logical Volume Management - LVM

User & Group Administration

Package Management

Network File System - NFS

Domain Naming System - DNS

Apache HTTP Web Server

KickStart Installations

FTP server

BOOT PROCESS

Dynamic Host Configuration Protocol - DHCP

Job Scheduling

File Links

Swap Management

Log Management

Performance Management

Linux Troubleshooting

Linux Summary

Start Preparation Smartly

We have the collection to start prepartion smartly.

Start Assessment

Red Hat Linux Reference Guide

  DevOps Tech Hub

116 Followers

VI-Editor Commands


VI EDITOR Commands:

Here describing Vi-Editor commands which mostly used to  manage the content in a file in Linux.

How to Move the Cursor 

  • k  – Move the cursor to top line
  • j  –  Move the cursor to the bottom line
  • h – Move the cursor to the right by one cursor position (from system side)
  • l  –  Move the cursor to the left by one cursor position (from system side)

Below table shows very frequently used commands in Vi-Editor:

VI-EDITOR COMMANDS

i

Insert text before the cursor position

a

Append text after the cursor position

A

Append text after end of the line

ESC

Switch to Command Mode

u

Undo changes

U

Undo all changes in the cursor line

dd

Delete line at cursor position

Ndd

Delete N number of lines from cursor line N=1,2,3…

yy

Yank(copy) line

Nyy

Copy N number of lines from cursor line

P

Paste the copied text

G

Move the cursor to the last line of the file

NG

Move the cursor to the starting position of N line N=1,2, 3...

r

Replace single character at cursor position

R

Replace all characters from cursor position


x

Delete single character at cursor position

X

Delete single character before the cursor position

:w

Save File

:wq

Save and Quit from Vi-Editor

:q

Quit file

:q!

Force Quit – Quit without saving the file

:set nu

Set line numbers to the file


Previous Next