LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do you save and exit VIM in Ubuntu server (https://www.linuxquestions.org/questions/linux-newbie-8/how-do-you-save-and-exit-vim-in-ubuntu-server-4175431886/)

skinney 10-12-2012 12:55 PM

How do you save and exit VIM in Ubuntu server
 
trying to set up a ubuntu (12.04) server
totally new to linux
i'm trying to get samba running
i edit my smb.conf file and exit using "ZZ"
it takes me back to command prompt but the file doesn't change and the .smb.conf.swp remains. i get a message telling me this when i try to reopen smb.conf.
what am i doing wrong?

Wim Sturkenboom 10-12-2012 01:18 PM

Code:

:w saves (write)
:q quits
:wq saves and quits


skinney 10-12-2012 01:36 PM

thank you!

shivaa 10-12-2012 01:44 PM

Vim editor is nothing but improved edition of Vi editor and all functions of Vi will also work in Vim.
In your case, you can close the file with following colon mode commands:
:w - Save
:wq - Save and quit
:wq! - Save and quit forcefully.

But as far as I could understand, in your case, it might be a problem of super-user privilages. I think you're opening the file directly as:
vim <filename>
Ubuntu don't by default gives you the root or super-user privilages, but you need to use sudo to access that. So just try to open the file with sudo command, as:
sudo vim <filename>
Enter your password:

It will give you super user privilage to modify the file.
Let me know if it helps you!

skinney 10-12-2012 03:22 PM

:wq does the trick
i have been opening with sudo
i didnt know what sudo meant but the howto's tell me too lol
thanks!


All times are GMT -5. The time now is 03:00 PM.