How to exit the vi command in Linux
To exit the vi command, you can follow these steps:
- Press the Esc key to ensure you are in command mode.
- Enter a colon (:) to enter command mode in vi.
- Pressing q and then the Enter key will exit the vi command.
- If you are editing a file and have made changes to its content, you can use the force quit command q! to discard the changes and exit.
If you accidentally entered the vi command while performing editing operations, you can exit by following these steps:
- Press the Esc key to make sure you are in command mode.
- Enter a colon (:) to enter command mode in vi.
- Type q! and press Enter, this will force quit vi command and discard any changes.
Please note that in the vi command, all commands are case sensitive, make sure to enter the commands correctly with the correct casing.