How Do I Save a Bash Script in Linux?
Contents to Save and Quit Press Shift + Z + Z, :Wq, or in Command Mode. If You Are Opening the File in Read Only Mode You Will Have to Hit: Q! . How Do I Save...
Contents
To Save and quit press Shift + Z + Z , :wq , or in command mode. If you are opening the file in read only mode you will have to hit :q! .
How do I save a script in Linux terminal?
To save a file, you must first be in Command mode. Press Esc to enter Command mode, and then type :wq to write and quit the file.
…
More Linux resources.
| Command | Purpose |
|---|---|
| i | Switch to Insert mode. |
| Esc | Switch to Command mode. |
| :w | Save and continue editing. |
| :wq or ZZ | Save and quit/exit vi. |
Must Read
How do I store a bash script?
Follow below PATH to achieve this:
- Create a folder using mkdir $HOME/bin.
- Then put your script in $HOME/bin.
- Finally, add the following line under $HOME/. bashrc by editing with gedit $HOME/. bashrc.