Swap file already exists when attempt to open file in linux textual content editor
If you happen to’re seeing an error just like the above a couple of various things could have occurred.
First, you will have shut down your connection to your distant host unexpectedly or prematurely with a file nonetheless open (or a foul Web connection did it for you).
The opposite problem happens when two or extra persons are attempting to edit the identical file on the identical machine.
Alternatively you could possibly have a number of textual content editors open and also you’re trying to edit the identical file in two totally different home windows.
Linux creates a .swp file if you open a file in vim. The file title begins with a interval, so it’s a hidden file you don’t normally see or want to consider. Nevertheless, if you’ve bought two folks modifying the identical file, the file could change into corrupted as a result of each situations of the open file try to make use of the identical .swp file. You’ll most likely simply wish to have one editor with the file open at a time.
In case your machine or connection was terminated unexpectedly, you’ll be able to see the swap file by navigating to the listing the place your file exists and operating the next command:
ls -al
That may present a listing of all of the recordsdata together with the one which begins with a interval [.] and ends with .swp.
Merely delete the .swp file with the next command and you have to be good to go:
rm .*.swp
That may delete any .swp recordsdata that exist within the present listing.
Watch out to not run rm * or one thing that deletes every little thing in your listing.
Teri Radichel
If you happen to preferred this story please clap and comply with:
Medium: Teri Radichel or E mail Record: Teri Radichel
Twitter: @teriradichel or @2ndSightLab
Requests providers by way of LinkedIn: Teri Radichel or IANS Analysis
© 2nd Sight Lab 2022
____________________________________________
Creator:
Cybersecurity for Executives within the Age of Cloud on Amazon
Want Cloud Safety Coaching? 2nd Sight Lab Cloud Safety Coaching
Is your cloud safe? Rent 2nd Sight Lab for a penetration check or safety evaluation.
Have a Cybersecurity or Cloud Safety Query? Ask Teri Radichel by scheduling a name with IANS Analysis.
Cybersecurity & Cloud Safety Assets by Teri Radichel: Cybersecurity and Cloud safety courses, articles, white papers, displays, and podcasts