Question: How to Save a File in Linux Command Line?
Contents

Once you have modified a file, press [Esc] shift to the command mode and press :w and hit [Enter] as shown below.

To save the file and exit at the same time, you can use the ESC and key and hit [Enter] .

Optionally, press [Esc] and type Shift + Z Z to save and exit the file.

How do I save a file in Linux command?

After making changes to a file, press [Esc] to shift to the command mode and press :w and hit [Enter] to save a file. To exit Vi/Vim, use the :q command and hit [Enter] . To save a file and exit Vi/Vim simultaneously, use the :wq command and hit [Enter] or command.

How do you save a file in Terminal?

2 Answers

  • Press Ctrl + X or F2 to Exit. You will then be asked if you want to save.
  • Press Ctrl + O or F3 and Ctrl + X or F2 for Save and Exit.
Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest