I'm trying to edit /etc/hosts using Vi in Cygwin but it's read only. Is there a command similar to sudo? How do I edit a read-only file?

Thanks

link|improve this question
feedback

1 Answer

up vote 1 down vote accepted

Try doing a forced overwrite. Instead of :wq to write and quit, try: :wq! to force write and quit.

link|improve this answer
Didn't work.... – Casey Mar 20 '11 at 17:57
Try using the Windows runas command then? runas /user:Administrator vi /etc/hosts – Majenko Mar 20 '11 at 17:59
Running cygwin as administrator allowed me to edit the file. Thanks for your help – Casey Mar 20 '11 at 18:05
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.