Hi All,
Now we are going to use world's most powerful editor vi.
Before we go further just learn how to create a hidden file in linux and see it.
If we want to change the matter of file cat will not do it for us. So we will use vi editor to change matter of file.
Now we are going to use world's most powerful editor vi.
Before we go further just learn how to create a hidden file in linux and see it.
$cat > [.name of file]A single dot in front of the file will make it hidden. For example to make a file named secret to hidden use this command
$cat > .secret This is a secret fileNow normal ls command will not list this file. Do a ls form current directory
$lsAs you can see in output .secret file is not shown here. But can see hidden file with –a switch.
$ls –a .secretNow rename and make it unhidden. Use mv command to rename the file
$mv .secret test $ls test
$vi testThis will open a window with bilking cursor. vi editor work in three different mode.
Esc Command mode [press Esc key before giving any command] Insert Insert mode [ to start editing use press Insert key ] Exit Exit mode [ Exit mode can be access via press Ecs key and :]Beside it there are various command which can be used to control the behavior of vi editor, some of them most command are there to remember
Esc +:+w+q save and exit form file Esc+:+q+! exit without saving Esc+:+set nu to show hidden line Esc+:+/test to find test word in forward directions Esc+:+21 to move cursor in line number 21 Esc+:+2+yy to copy 2 line form cursor Esc+:+p to paste the copied line below the crusor Esc+:+dd to remove the entire line Esc+:+4+dd to remove 4 line below of cursor Esc+:+x to remove single character Esc+:+e to go to end of the word Esc+:+h to go one character back
No comments:
Post a Comment