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