The swap file “*.swp” already exists under Linux, the solution

Under Linux, if you have a problem with "*.swp" existing when using a text editor, it is usually because the editor unexpectedly exited or crashed the last time you edited the file and the temporary file was not deleted normally. The way to solve this problem is as follows:

  1. First, make sure you are not currently editing the file. If you are using the vim editor, you can force close the vim session with:

    rm -f /path/to/file.swp

    Please replace "/path/to/file.swp" with the actual file path you edited.

  2. If you cannot determine the path of the temporary file, you can try to find the file ending with ".swp" in the directory where the file is located, and delete it:

    find /path/to/directory -name "*.swp" -delete

    Please replace "/path/to/directory" with the directory path where the actual file is located.

  3. After deleting the temporary file, you can reopen the editor and edit the file, and the problem of "*.swp" existing should not appear again.

Note, before doing anything, make sure you understand the implications and back up important files. Also, if you're still having issues, consider using a different editor or try manually restoring the temporary file in the editor.

Hope the above solutions can help you solve the existing problems of "*.swp" under Linux, and restore normal editing files. If you have other questions, please consult the relevant documentation or seek further support from the Linux community.

Guess you like

Origin blog.csdn.net/tiansyun/article/details/132273848