VIM EDITOR - LINUX - DAY-04
VIM EDITOR: IT IS A EDITOR IN LINUX OS WHICH IS USED TO EDIT THE REGULAR FILES.
WE HAVE 3 MODES IN VIM EDITOR
1. COMMAND MODE
2. INSERT MODE
3. SAVE & QUIT MODE
1. COMMAND MODE: IT IS USED TO PERFORM SOME ACTIONS LIKE COPYING THE DATA,
DELETE THE DATA, UNDO THE DATA ETC..
COMMAND IS THE DEFAULT MODE IN VIM EDITOR
gg : used to go to first line of the file
G : used to go to last line of the file
3gg : used to go to 3rd line of a file
:3 : we can go to 3rd line of a file
: set number : used to set numbers to a file
yy : used to copy the line
3yy : used to copy 3 lines
p : used to paste the data
3p: it prints the copied content 3 times
dd : delete the line
5dd : delete 5 lines at a time
u : used to undo the changes
ctrl + r : used to redo the changes
/word : used to search for a word
?word : used to search for a word
INSERT MODE: IT IS USED TO INSERT THE DATA INTO A FILE. IN INSERT MODE, KEYS WILL
NOT GETS WORK.
i : used to go to insert mode
esc : used to go to command mode from insert mode
A : used to go to the end of the line
I : used to go the starting of the line
O : used to create a new line (up)
o : used to create a new line (down)
SAVE & QUIT : IT IS USED TO SAVE THE DATA IN A FILE AND QUIT FROM VIM EDITOR
:w : to save the data
:w! : forcefully save the data
:q : used to quit from vim editor
:q! : forcefully quit from vim editor
:wq : save& quit will happen at a time
:wq! : save & quit forcefully
============================================
TO UNDERSTAND ABOUT THE FILE/FOLDER
-rw-r--r-- 1 root root 553 Apr 5 02:21 aws
type of the file:
hyphen (-) : regular file
d : directory file (folder)
c : character file
b : blocked file
PERMISSIONS: rw-r--r--
r : read : 4
w : write : 2
x : execute : 1
hyphen (-) : nothing : 0
ACL (Access Control List) :
file ---> 1
folder ---> 2
OWNERS:
user : root
group : root
NO OF CHARACTERS IN A FILE:
553
FILE CREATION DETAILS : Apr 5 02:21
FILE NAME: aws
======================================================================
vim -o file1 file2 : used to see 2 files at a time in vi editor
vim -O file1 file2 : used to see 2 files at a time in vi editor
gpg -c filename : used to encrypt a file
gpg -d filename : used to decrypt a file