z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Saving a file

z/OS UNIX System Services User's Guide
SA23-2279-00

When you finish editing text, you must save your work in a file. Until you save your work, your text is on the screen but it is not recorded in any usable way. When you quit vi, your work disappears unless it is saved.

If you started your vi session with vi filename, it is easy to write the edited text back into the same file. In Command Mode, just type:
:w
and press <Enter>. When you type the colon, it appears at the very bottom of the screen. The w also appears . When you press <Enter>, there is a short pause and then vi displays some statistics about the saved text: the name of the file, and the number of lines and characters saved.
If you want to save your changes and quit vi, enter:
:wq
If you want to save your text in a different file, type:
:w newfilename
and press <Enter>. Again, this appears . After you save your work, you can quit vi by typing:
:q
Normally, vi does not let you quit before saving; if you do, you lose everything you have done since the last time you saved. If you really want to quit vi without saving your work, type:
:q!
If the file system that you are attempting to save your file to is full, you will see the following message:
FSUM7971 Write error (out of space?)
At this point, you should issue a command to save your file to a new file system where space is available. This can be done by typing:
:w newfilesystem/newfilename
where newfilesystem is the name of another file system that has space available, and newfilename is the name you wish to call the file.

Once the original file system has space available, you can safely copy the file back to that location.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014