LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-06-2003, 09:48 PM   #1
neozero62
Member
 
Registered: Oct 2003
Distribution: Red Hat 9
Posts: 103

Rep: Reputation: 15
Cool 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
 
Old 11-06-2003, 09:54 PM   #2
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
1. su -
2. chmod 777 filename
3. vi filename
4. *do your edits*
5. in vi command mode: => wq
 
Old 11-06-2003, 10:00 PM   #3
neozero62
Member
 
Registered: Oct 2003
Distribution: Red Hat 9
Posts: 103

Original Poster
Rep: Reputation: 15
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
 
Old 11-06-2003, 10:20 PM   #4
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving To X86Config 311Sam Linux - Software 4 04-28-2004 05:49 PM
saving aliases sensovision Linux - General 2 03-14-2004 12:31 PM
saving and not saving sessions on desktop ergo_sum Linux - Newbie 2 09-26-2003 07:27 AM
saving jcue Linux - Newbie 8 08-11-2003 12:37 PM
Saving settings funkenbooty Linux - Newbie 3 07-29-2003 02:22 PM


All times are GMT -5. The time now is 08:42 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration