View Full Version : cant edit fstab file with vi
steve1084
13th December 2006, 04:19
I am setting up a ubuntu 6.10 web server and made a typo when I first edited the fstab file
I went back into the file using vi when I realised I had made an error but file is now read only and vi wont let me save the changes
Tried chmod but no effect
What is the command to save changes for a read only file or is there an alternative editor I should be using
This is my first attempt at linux and setting up a server:confused:
Any help appreciated
Thanks
Steve
martinfst
13th December 2006, 11:21
I assume you are already root or using vi like 'sudo vi /etc/fstab'.
The vi command to force write is ':w!' (no quotes). If you want to leave vi immediately, you can use ':x!' also.
For small font fanatics: Read carefully. It's <colon><x><exclamation mark>.
Martin
steve1084
13th December 2006, 15:48
yes that worked
Im not used to dealing with command script but Ill get used to it! Maybe
Steve
falko
14th December 2006, 19:26
This link might help you getting used to vi: http://www.howtoforge.com/faq/12_15_en.html :)
Linocks
17th December 2006, 09:48
I am setting up a ubuntu 6.10 web server and made a typo when I first edited the fstab file
I went back into the file using vi when I realised I had made an error but file is now read only and vi wont let me save the changes
Tried chmod but no effect
What is the command to save changes for a read only file or is there an alternative editor I should be using
This is my first attempt at linux and setting up a server:confused:
Any help appreciated
Thanks
Steve
Steve,
You may find using nano as a file editor more user-friendly for beginners. If you installed the Edgy-Eft using the 'HowTo' on this site it would have been installed. I am also a newbie and I found it easy to use. It also has some of the popular commands 'hinted' at the bottom of the window whilst in edit mode.
Instead of typing :-
vi <filename>
Type :-
nano <filename>
I hope you find this helpful. :)
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.