cant edit fstab file with vi

Discussion in 'Installation/Configuration' started by steve1084, Dec 13, 2006.

  1. steve1084

    steve1084 New Member

    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
     
  2. martinfst

    martinfst Member Moderator

    root

    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
     
  3. steve1084

    steve1084 New Member

    thanks

    yes that worked

    Im not used to dealing with command script but Ill get used to it! Maybe

    Steve
     
  4. falko

    falko Super Moderator Howtoforge Staff

  5. Linocks

    Linocks New Member

    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 :-

    Code:
    [B][I]vi <filename>[/I][/B]
    Type :-

    Code:
    [B][I]nano <filename>[/I][/B]
    I hope you find this helpful. :)
     

Share This Page