-   Linux - Newbie (
-   -   Saving in VI (

neozero62 11-06-2003 10:48 PM

Saving in VI
Simple question: I am trying to edit a read-only file in VI. I open the file as root, and make the changes. I press Shift+"ZZ" and it says I am attempring to save a read-only file, and to add "!" to save the changes. Well, I types the following, ":ZZ!", ":!ZZ", and neather worked. Anyone know the command to save a edited read-only file in VI? Thanks!
-Neo:scratch: :scratch: :scratch:

megaspaz 11-06-2003 10:54 PM

1. su -
2. chmod 777 filename
3. vi filename
4. *do your edits*
5. in vi command mode: => wq

neozero62 11-06-2003 11:00 PM

Hey, Thanks! But, What is "chmod 777 <filename>"?? I assume it takes the read-only attribute off? If so, How do I put the attribute back when I am done? Thanks again

megaspaz 11-06-2003 11:20 PM

it gives write permissions to everybody. actually once you "su -"ed you didn't need to chmod it (sorry, braindead me be). you could have just typed vi filename and saved it. but to change it back, su into root if you're as your regular user and use:

chmod 755 filename

All times are GMT -5. The time now is 05:15 PM.