Why does a log file have the extension swp?

Go To StackoverFlow.com

3

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?

2012-05-09 16:01
by user1253847


9

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.

2012-05-09 16:03
by larsks


2

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.

2012-05-09 16:04
by jmort253
Ads