When someone mentions a "swap file", the first thing that comes into your mind might be the kind of file that you would create to increase the swap space on a Unix system. Think swapfile and the swapon command. But there's another kind of swap file that comes into play, generally when you're trying to edit a file that might have encountered some difficulties during a prior edit.That type of swap file is created by your system to help ensure that you don't lose important file content when something goes wrong. And it generally sits in the same directory as the original file and has .swp as its extension.
- When you start a edit session using vim editor and some problem occure and you did not saved file and quite. +If some one is editing that file remotely and you also try to open it with vim editor.
in those case we get below attension message.
E325: ATTENTION
Found a swap file by the name ".laravel.log.swp"
owned by: root dated: Wed Jun 10 17:03:49 2020
file name: /opt/lampp/htdocs/mhn-admin-ms/storage/logs/laravel.log
modified: no
user name: root host name: ip-172-31-20-213
process ID: 16030 (still running)
While opening file "laravel.log"
dated: Wed Jun 10 17:03:45 2020
(1) Another program may be editing the same file. If this is the case,
be careful not to end up with two different instances of the same
file when making changes. Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r laravel.log"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file ".laravel.log.swp"
to avoid this message.
Swap file ".laravel.log.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort:
The above attension will not occure if you started an edit session and made changes and saved the file and qite using :wq
These swap files store content for the specific file for example. when you start edit session these .swp file will be generated and will be removed once youe save and quite the session without any intruption.
In My case i was trying to open laravel.log file in side my laravel project directory and i got this attension message.
Swap file ".laravel.log.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort:
Here file is already there with a temp file haveing .swp extension.
'rm ..swp'
'vim laravel.log' and your file is ready to eding on vim editor.
Thanks .... if you have any query ask your question in comment box
'
MotoShare.in is your go-to platform for adventure and exploration. Rent premium bikes for epic journeys or simple scooters for your daily errands—all with the MotoShare.in advantage of affordability and ease.