Page 31 - RHEL8 BOOK
P. 31
1. Commands: - To go from command mode to insert mode
Command Action
i Insert text before current cursor position
I Insert the text at beginning of line
a Append text after current cursor position
A Append text at the end of the current line
o Open new line below the current line
O Open new line above the current line
r Replace a single char at current cursor position
2. Command mode Copying and Pasting text
Command Action
yy Copy the current line in buffer
2yy Copy the current 2 line in buffer
p Paste the copy data below the current line
P Paste the copy data above the current line
dd delete current line
2dd delete current 2 line
u Undo
Ctrl + r Redo
G Move the cursor to the last line of file
th
5G Move the cursor to the 5 line of file
3. Commands in execute mode
Saving and quitting
Command Action
:w Write change into the file without quitting
:w! write change into the file even if you are not owner of the file
:wq write change into the file and quit
:wq! write change into the file and quit even if you are not owner of the file
:q quits when no changes are made
:q! quits without saving the changes made
:set number Setting line numbers
:se nu Setting line numbers
:set nonumber Removing line numbers
:se nonu Removing line numbers
:84 Press enter goes to line 84
1,$s/old name/new name Replace the word name
To Find and replace words
:1, $s/world/universe/gc
st
1 To start search at from 1 line
$ End of file
s substitute
g global
c confirmation
S. Pradhan
(MCA, MBA-IT, BCA, CCNA, MCSA 2012, RHCE, ETHICAL HACKING)
Email Id:-spradhan.iiht@gmail.com
31