vi
 

cat=input in console output=console

cat test=data in test. output is console

cat test >test1=data in test. copy to test1

cat test>>test1=data in test.append to test1

cat test=data typed in console, copied to test.

=================================================

:set number, : set nonumber= to display line numbers

set showmode, : set noshowmode===to display insert or append mode

========================================

:w hello.txt,:wq, :q!, ZZ, :sh to execute shell commands temporarily(ctrl_d)

a,i,o,A,I,O,:r another_file_name, cw,s(one char with a string),S(rest of the line)

r=replace one char, R type over

ctrl-dufb

HML,hjkl,^,$,w,b,e

d,dw,d5w,dd,D,d5d,5dd,x,5x,

p,P,u,U

yy,"z6yy,yw,"a8dd, "A8dd,"ap

   :%s/apple/orange/g

                      %>>>>for line number 1 to last line.

                                 s>>>>substitute

                                 apple/orange  >>> apple by orange

                                 g >>>  all occurance in that line

  : .,.+10 s/apple/orange

            .  from the current line

            .+10  for the next 10+current lines

             s/apple/orange >>> replace apple by orange

             /g is missing : Hence only one occurance in each line to be replaced

 

 

 

 

 

 

 

 

 

 

vi editor cheat sheet