[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-developers] [RaQ3] VI, and telnet commands



Mark,

Here's a quick breakdown on copying and editing a file.

On Saturday, October 7, 2000, at 01:16 PM, Mark Baker - Cobalt Lists wrote:

> Hi all, 
>  
> Can some nice person give me the commands to backup a file (copy), replace 
> it in telnet, and the general VI commands to: 

To copy a file from shell:

$ cp file newfile

This make a copy of 'file' in 'newfile'.
  
> edit file 

$ vi file

The remainder are for use in VI:

> find part of a file 

Type a slash (/) followed by the characters you want to search for and press enter.  To search a second time, press the 'n' key (you can also press the slash key followed by the enter key).

To search backwards, use a question mark (?) instead of a slash.

> insert a word/letter 

Press the i key.  You're now in insert mode.  Anything you type will be inserted until you press the escape key.

> remove something 

x      delete a character forward
X     delete a character backard
dw  delete a word forward
dd   delete a line
d$   delete from cursor to end of line
d^   delete from cursor to beginning of line

> Close and save 
:wq   write file and quit VI
:wq!  write file (force) and quit VI - may be necessary because of file perms
:q!     quit VI but don't save changes


You can also use control-Z control-Z (^Z^Z) to write and quit, but I've found over the years that a lot of people just use that as a quick shortcut to exit vi and end up saving changes they didn't mean to.   For that reason, I prefer :q! and :wq! instead.  If you just want to look at a file, use 'view' rather than 'vi'.

>  
> and.. the command to reboot the server (httpd) from telnet! 

On the Raq3i, /bin/su  to root and:

/etc/rc.d/init.d/httpd restart

Hope it helps,

 - Dave

--

"I think not," said Descarte.  Then he was gone.