In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces what the linux swp file refers to, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
The linux swp file is a file with the suffix ".swp", which is generated when editing a file using vi or vim, and is automatically deleted when the editing is completed and exits normally; the swp file is hidden and can only be viewed using "ls-al" in the directory.
The operating environment of this paper: Centos 7.6 system, Dell G3 computer.
The generation and solution of .swp file in Linux:
We use the vi command to edit the nginx.conf configuration file, as shown in the figure. We can also press the E key to edit normally at this time, but it may still appear next time. So what is the cause of this problem?
The following are two situations that can occur
(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 nginx.conf" to recover the changes (see ": help recovery"). If you did this already, delete the swap file ".nginx.conf.swp" to avoid this message
To explain, this occurs when this file produces an exchange file, that is, a file with the suffix .swp
1: when we edit a file and another person is editing it, it will appear.
2: when we edit a file, there is a sudden power outage or a sudden network outage. this kind of file will also appear in order to prevent data loss.
The .swp file is swap (swap partition). When you edit a file using vi or vim, it is generated. When editing completes and exits normally, the file is automatically deleted. The .swp file is a hidden file and can only be viewed using ls-al in the directory.
When generating this file, we can delete the swp file directly rm-f .nginx.conf.swp, otherwise we will be prompted every time we edit it, but if we exit abnormally after editing the file and our configuration is not saved in the nginx.conf file, we need to use vi-r nginx.conf to restore the file. If the file is restored as shown in figure, then enter, the configuration will be restored from .swp to nginx.conf. Then delete the .swp file
If we change the settings to generate the .swp file, we can add the set noswapfile command to the vim configuration (/ etc/vimrc) to disable the generation of this file during editing (set swapfile generates this file). However, it is recommended that you learn to use this file normally. Linux developers are more thoughtful and take full account of the mechanism in case of system exception to avoid data loss in case of system exception.
Thank you for reading this article carefully. I hope the article "what the linux swp document refers to" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.