vi how to save and quit code example Example 1: vi save and exit //Save :w //Exit :q Example 2: vi write and exit wq // write and quit