VMware Cloud Community
ratkinson
Contributor
Contributor
Jump to solution

How to search for and delete files (hosts.swp)

I have modified the etc\hosts file and lost network connectivity while i was editing it.

When I launch putty and connect to the ESX host and try to edit the file, i get an information alert.

I have also looked in the \etc directory and there is only 1 hosts file

How can i find the file and delete it.

E325: ATTENTION

Found a swap file by the name ".hosts.swp"

owned by: root dated: Wed Mar 25 12:09:41 2009

file name: /etc/hosts

modified: YES

user name: root host name: esx2.ea.local

process ID: 28055

While opening file "hosts"

dated: Wed Mar 25 12:16:15 2009

NEWER than swap file!

(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 hosts"

to recover the changes (see ":help recovery").

If you did this already, delete the swap file ".hosts.swp"

to avoid this message.

"hosts" 8L, 269C

Hit ENTER or type command to continue

Thank You

0 Kudos
1 Solution

Accepted Solutions
jasoncllsystems
Enthusiast
Enthusiast
Jump to solution

rm -rf /etc/.hosts.swp

Regards,

CLL SYSTEMS http://www.cllsystems.com

MALAYSIA VMWARE COMMUNITIES

http://www.malaysiavm.com

http://www.malaysiavm.com

View solution in original post

0 Kudos
5 Replies
Sanjana
Hot Shot
Hot Shot
Jump to solution

I think you need to look for

.hosts.swp (note the "." before the filename).An "ls -a" should show you the file.

That is a temporary file created by your editor while you were editing the /etc/hosts file.

--sanjana

petedr
Virtuoso
Virtuoso
Jump to solution

If you take option 2 to recover you should also be ok and remove the temporary file (hosts.swp) that was left there from the crashed edit session.

Also as when posted doing a ls -al should show the .hosts.swp file. Files starting with a . are not shown in an ls command with the -a option.

www.phdvirtual.com, makers of esXpress

www.thevirtualheadline.com www.liquidwarelabs.com
jasoncllsystems
Enthusiast
Enthusiast
Jump to solution

rm -rf /etc/.hosts.swp

Regards,

CLL SYSTEMS http://www.cllsystems.com

MALAYSIA VMWARE COMMUNITIES

http://www.malaysiavm.com

http://www.malaysiavm.com
0 Kudos
ratkinson
Contributor
Contributor
Jump to solution

Thank You. I deleted the file and it seems to be working great now.

0 Kudos
petedr
Virtuoso
Virtuoso
Jump to solution

Good to hear things are working now, thanks for the helpful.

www.phdvirtual.com, makers of esXpress

www.thevirtualheadline.com www.liquidwarelabs.com
0 Kudos