The command to quit Vi without saving is : q Press Esc to enter the Command Mode. The command to quit Vi by saving is: wq or simply type ZZ command.