Editing (vi) large files in Solaris

When editing extremely large files using vi the following message may appear when you open it:

Not enough space in /var/tmp

The default directory /var/tmp is used for the vi editing buffer and needs space equal to roughly twice the size of the file which you are working on, because vi uses extra lines for buffer manipulation.

Resolution

We can use the following steps to edit your large file without receiving the above error message:

  1. open vi
  2. set the buffering directory
  3. edit your large file

For example:

$ vi
:set directory=/tmp
:e filename

Replace /tmp with any directory containing enough space for use as the vi buffer. Replace filename is the name of your large file.