vi command to Create & Update Files in Linux | 18 useful and advance Examples | SP 12

Опубликовано: 21 Февраль 2026
на канале: Dr. Ghazanfar Latif
1,775
48

vi command to Create & Update Files in Linux | 18 useful and advance Examples:
vi file1
Open the existing file or create a new file named file1
Press ESC key
To shift to Control / Command Mode
Press i or a key
To shift to Edit Mode
:w
To Save/write the file but make sure you are in Control/Command mode.
:q
To Close/Quit the file but make sure you are in Control/Command mode.
:wq OR zz
To write and close the file but make sure you are in Control/Command mode.
:q!
Enforce to Close/Quit the file without saving the file but make sure you are in Control/Command mode.
:e!
Read the original file again to start over without saving the changes
$
Go to the end of the line
^
Go to the start of the line
W
Go to the next word
B
Go to the previous word
Shift + G
Go to the last line of the File
10 Shift + G
Go to the 10th line of the file
Y
Copy (Y2W copy 2 words, Y2J copy 2 lines
P
Paste the copied contents
D
Cut the selected letter
X
Delete the character under the curser