Home  >  Article  >  Operation and Maintenance  >  What file has the suffix of linux swp?

What file has the suffix of linux swp?

青灯夜游
青灯夜游Original
2023-04-17 09:39:264092browse

In Linux, the file with the swp suffix is ​​a swap partition file, which is generated when using vi or vim to edit a file. When the editing is completed and exits normally, the file will be automatically deleted; the swp file is hidden Files can be viewed by using "ls -al" in the directory.

What file has the suffix of linux swp?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

The file with swp suffix is ​​the swap partition file.

1. The phenomenon of swp files appears

We use the vi command to edit a file, and a prompt appears as shown in the figure. At this time, we can also directly Press the E key to edit normally, but it may still happen next time.

What file has the suffix of linux swp?

2. Reason

#1: When we edit a file, another person Also when editing, it will appear;

2: When we are editing a file, there is a sudden power outage or a sudden disconnection from the Internet. In order to prevent data loss, this kind of file will also appear.

3. Solution

When this file is generated, we can directly delete this swp file with rm -f .abc.swp, otherwise A prompt will appear every time the file is edited, but if an abnormal exit occurs after editing the file, our configuration is not saved in the abc file. We need to use vi -r abc to restore, as shown in the figure to restore the file. , and then press Enter, the configuration will be restored from .swp to abc, and then delete the .swp file

Steps:

First, we need to use vi -r Kmer_evaluation.py to restore , will open the file, press Enter, save and use wq! Do not use wq, it will be restored from .swp to Kmer_evaluation.py

vim -r Kmer_evaluation.py

Then delete the .swp file

rm -rf .Kmer_evaluation.py.swp

Related Recommended: "Linux Video Tutorial"

The above is the detailed content of What file has the suffix of linux swp?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn