* Creating File's
1. touch
- To
create a empty file ( 0 KB )
-
Drawback : We can not write,modify,read file content
# touch test
# touch a b c
2. cat (
Concatenate )
- To
create file, write file , read file content.
-
Drawback : We can not modify the file content
# cat > test
WELCOME
Press Ctrl + d ( To save and Quit file )
#
cat test ( To read file content )
# cat >> test
WELCOME
REDHAT
Press Ctrl + d ( To save and Quit file )
3. vi ( Visual
Interface )
- VI is a text editor tool it is used for to create file, write file ,
read file content,to
modify file content.
-
Drawback : no colour highlighting feature
# vi test
Press "i" OR "
"Insert" Key
WELCOME
Press Esc , Press Shift+ : , wq! ( To
save and Quit file )
Press Esc , Press Shift+ : , q!
( To Quit file )
4. VIM ( VI
Improved )
- VI is
a text editor tool it is used for to create file, write file , read file
content,to
modify file content. Also called modal editor because without using mouse.
# vim linux
Press "i" OR "
"Insert" Key
WELCOME
Press Esc , Press Shift+ : , wq! ( To
save and Quit file )
Press Esc , Press Shift+ : , q!
( To Quit file )
* Mode's
Of VI and VIM
---------------------------------------------------------------------------------------------
1. Insert Mode : Normal text editing. To
write and Modify file content.
ESC
+ i
Entering Insert mode
i At
the cursor.
a After the
cursor.
I
Before the current line.
A After the
current line.
o
Insert a new line after the current line.
O
Insert a new line before the current line.
C
Ovewrite the whold current line.
ESC Exit Insert
mode.
2. Ex (
Extended Mode ) : To save and Quit file. Open, search, replace
:wq!
(save and quit)
:q!
(quit without saving)
:w
(save only)
:set nu Display line
numbers.
Esc
:set nu
To set Line numbers
Esc :Line
Number
To go to the specific line
:%s/searchtext/replacetex/g
:q!
:q!
:q!
:q!
:q!
3. Command
Mode : It is used to perform linux yanking or file navigation operation
( cut , copy , paste, undo, redo)
Shortcut Key
Purpose
Esc yy
To copy Entire Line
Esc p
To Paste Or Put
Esc cc
To cut Entire Line
Esc dd
To delete Entire Line
Esc yw
To copy word
Esc cw
To cut word
Esc dw
To delete word
Esc nyy
To Copy n number of lines
Esc Shift + g
To go to the last line
Movement
h
Move left one character.
j
Move down one character.
k
Move up one character.
l
Move right one character.
w Move
forward one word.
b
Move to the start of the word.
e
Move to the end of the word.
(
Move back one sentence.
)
Move forward one sentence.
{
Move back one paragraph.
}
Move forward one paragraph.
^ Move to
the beginning of the line.
$
Move to the end of the line.
<n>G Move to the nth line.
G
Move to the last line.
gg
Move to the first line.
%
Move to the matching bracket.
|
Comments
Post a Comment