My log files are generated inside a particular directory on my Linux server. Sometimes when I view the log files inside that directory using ls -lart
, I see:
abc.log
.abc.log.swp
Could anybody please explain why the log file has the name .abc.log.swp
?
Those are vim
"swap" files -- temporary files created by vim
while you are editing a file. They are (usually) removed automatically when you exit the editor.
When you edit a file using vi and some other editors, the editor creates a temporary swap file with the .swp extension. If something goes wrong and the editor crashes or the computer dies, the swap file contains your changes so you can revert back to the edited file.
As soon as you close the editor, the swap file should be deleted. If it isn't, and you didn't experience a crash, you can simply remove the swap file.