About the 2 macs and 1 linux on a LAN

E Frank Ball frankb at efball.com
Tue Jul 18 10:20:57 PDT 2000


} I think I know about a couple of editors:  vi and emacs

I use vi.  It isn't friendly for beginners but it is very powerful and
fast for experienced users.  I will attach quick reference guide for vi
that I wrote sometime back for training some people at work.

} > PATH=$PATH:/sbin:/usr/sbin
} > export PATH
} 
} When that is added to the file or directory, what is the effect?
} Is it possible for me to work at the root level and the user level at the
} same time?

Your PATH is a list of directories that tell where to look to find a
command you type in, or a command you click on in some menu.
If the path is in a directory that is not in your path, it cannot be
found unless you type in the full path name such as /sbin/ifconfig

You can see what your path is with "echo $PATH".
For example here is my path:
echo $PATH
/home/frankb/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:./:/home/frankb/:/sbin:/usr/sbin:/usr/local/sbin:/usr/hpegs/bin/

You are either root, or a user, not both.  root can do anything, users
can do what the file permissions tell them they can do.  In general
regular users can look at most things, but can't make changes to the way
the system runs.

You can see the file permissions with "ls -l".  Here are a couple of
files from /usr/sbin:

-rwxr-xr-x   1 root     root        18892 Sep 20  1999 utmpd
-rwxr-x---   1 root     root        19640 Sep 24  1999 vboxd
                ^        ^
               owner    group

The owner and group of these files is root, but the permissions are
different.  The permissions are defined by the "-rwxr-xr-x".

The leading "-" denotes this as a file.  "d" would be a directory, "l"
is a link, etc.

"rwx" gives the owner (root in this case) permissions to "read",
"write", and "execute" the file.

"r-x" give the group (root in this case) permissions to read and execute
only.  Write permission is not set.

The last field, the other users field, differs between the two files.
utmpd is set to "r-x" while vboxd is set to "---".  This says that
anybody else other than the owner or the group can read or execute
utmpd, but they cannot do anything with vboxd.

Permissions are changed with "chmod", see "man chmod"
Owners are changed with chown, see man chown.
Groups are changed with chgrp, see man chgrp.


	      
	      vi quick reference guide (also see "man vi")
		 written by Frank Ball frankb at sonic.net
			 last update:  07/18/00

vi		starts vi
vi <filename>	starts vi and opens file <filename>
vi -R <filename> or view <filename> 	opens file in read only mode

			    CURSOR MOVEMENT

j or <return>  	move cursor down one line
k		move cursor up one line
h		move cursor left one character
l or <space>	move cursor right one character

0	move cursor to beginning of line
$	move cursor to end of line
H 	move cursor to top of screen
M 	move cursor to Middle of screen
L	move cursor to Last line of screen

w	move cursor to beginning of next Word
b	move cursor Backwards to Beginning of word
e	move cursor to End of word

)	move cursor to beginning of next sentence
(	move cursor to beginning of previous sentence
}	move cursor to beginning of next paragraph
{	move cursor to beginning of previous paragraph

			     TEXT MOVEMENT

z<return>	move line with cursor to top of screen
z.		move line with cursor to middle of screen
z-		move line with cursor to bottom of screen

<CTRL>f		Forward one page
<CTRL>b		Backwards one page
<CTRL>u		Up one half page
<CTRL>d		Down one half page
<CTRL>y		move text up one line
<CTRL>e		move text down one line

G		Goto last line in file
:n		goto line number n
<CTRL>g		what is current line number, and total number of lines in file

		  INSERT APPEND REPLACE or CHANGE TEXT

i	Insert before the cursor, <ESC> ends
I	Insert at the beginning of the current line, <ESC> ends
a	Append after the cursor, <ESC> ends
A	Append to the end of the current line, <ESC> ends
o	Open new line below current line and enter insert mode
O	Open new line above current line and enter insert mode
r	Replace current character
R 	Replace text until <ESC>
cw	Change Word <ESC>
C	Change rest of line <ESC>
J	append two lines together
~	changes case of character (toggles upper to lower case and back)
xp	switch character under cursor with the following character

				DELETION

x	delete character
nx	delete n characters (n is a number)
D	Delete the rest of the current line
dd	Delete line
ndd	Delete n lines (n is a number)
dG	Deletes the rest of the file starting with the current line
:x,yd	Delete line number x through line number y. "." =3D current line.=20
	"$" =3D last line.  example ":1,.d" Deletes first line thru current line

			      MOVING TEXT

y	Yank current line
nY	Yank n lines starting with current line
p 	Place yanked lines after current line
P	Place yanked lines before current line

				SEARCHES

fx	search forward in current line to Find letter x
Fx	search backwards in current line to Find letter x
;	repeat last f or F search again
,	repeat last f or F search again backwards

/<string>	search for <string>, will wrap around to beginning of file
?<string>	search backwards for <string>
n		search for next instance of <string>
N		search in reverse direction for next instance of <string>

				  MISC

u		Undo last command
<ctrl>r		undo last undo
.		repeat last command
n<command> 	repeats command n times, this works for most commands

Commands starting with ":" are "ex" commands, see "man ex" for more info:

:%s/<string1>/<string2>/g  	Global substitution of <string1> with <string2>
:%s/<string1>/<string2>/gc       asks for Conformation before replacing each
    instance.  y<return> accepts change, <return> rejects change, <CTRL>c stops

:r <filename>	Reads in file
:w		Write to file
:w <name>	Write to file called <name>
:w! <name>	overwrite to existing file
:q		Quit
:q!		Quit without saving
:wq or :x or ZZ	Write to file and Quit


   E Frank Ball                frankb at efball.com



More information about the talk mailing list