LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Editing Files Via Shell (https://www.linuxquestions.org/questions/linux-general-1/editing-files-via-shell-146381/)

mattsmith999 02-15-2004 11:47 AM

Editing Files Via Shell
 
Hi

I want to be able to fully manage my linux server via SSH. I have Mandrake 9.2 installed with samba server. I will want to add samba shares via SSH, the only way I know of doing this is to edit the samba.conf file and restart the service, so I need to be able to edit it via the shell. I login as my user and use the command su to get root privs. Where do I go from here?

Thanks in advance!

Matt

DrOzz 02-15-2004 12:09 PM

well it depends what editor you want to use ... i will use "vim" in my example ..
so your now at a root prompt you can type :
vim /etc/samba/smb.conf
(thats the location on my box)
and basically just use your arrow keys when you get inside the file to move around or press :
Code:

/
and type a "keyword" to let vim find an occurance of it in real time, to get to a location quicker ..
then when you get to the part you want to edit you type :
Code:

i
to go into "insert mode" for that you can edit the contents ... and when your done editing you hit :
Code:

ESC
which gets you outta insert mode, and then you will save and quit the file by either of the following :
Code:

SHIFT ZZ
or :
Code:

:wq
these are just a couple of the basics to edit a file using vim, and there are many many more options .... you can sort through a search engine to find some docs that you like or for now you can look at :
vim simple commands
a vim tutorial
list of tutorials within the acutal HOWTO

mattsmith999 02-15-2004 12:16 PM

DrOzz

Thank you for your very detailed reply! Will give it a go and let you know how I get on.

Matt


All times are GMT -5. The time now is 10:25 AM.