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