Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Ubuntu, Linux, Unix vi error: swap file .swp already exists

Command that gave me error:
vi .env or vi <any file name that starts with a “.” that means it’s a hidden file>

Error:
Swap file .env.swp already exists
or
Swap file xxx already exists

Solution:
ls -A (This will show you if a .swp file really existd)
rm .filename.swp (This will delete the .swp file which was generated while you closed the session accidentally while editing the original file)

Verify the solution:
ls -A (Now you won’t see the .swp file that you deleted using the above command)