UNIX Linux , . UNIX : . Linux. 95% Linux UNIX-, - , Linux. .
- , MS-DOS. MS-DOS, . UNIX MS-DOS ( - MS-DOS CP/M, , , UNIX). UNIX MS-DOS. , .
, , :
.
.
. UNIX ,
"" ( )
. ,
- , ,
UNIX , . , , . ( MS-DOS, ). UNIX , : (, ) , ( ). , .
UNIX-
(
).
,
( ) ,
( 3.2.1 ).
``larry
''.
, UNIX
hostname ( ).
. Hostname
, ,
hostname. 4.10.2
hostname . ,
, - ``mousehouse
'' ( ).
, ,
. ,
(root
)
. root
,
4.1.
, ,
root
useradd
adduser
. 4.4.
, , :
mousehouse login:
larry
:
mousehouse login: larry
Password:
(password). , . ,
Login incorrect
.
, .
- , . ( UNIX , , , ). Linux, UNIX, ( VC), .
(
). login:
, ,
. VC,
Linux
VC,
, ( , ) UNIX. VC #1, VC #2 - .
UNIX
shell. Shell -
, , (..
, )
. COMMAND.COM
MS-DOS,
. Shell -
UNIX. ,
X Window System,
.
, shell . . Larry :
mousehouse login: larry
Password: larry's password
Welcome to Mousehouse!
/home/larry#
``/home/larry#
'' shell, ,
. ( y
). -
:
/home/larry# make love
make: *** No way to make target `love'. Stop.
/home/larry#
, , "make" - shell . (, ).
: ?
, ``make love
''?
``make
'' ,
.
.
:
/home/larry# cp foo bar
``cp
'', ``foo
'' ``bar
''.
, shell . -, , () shell . (, , shell . , ). Shell , . , shell . shell , , .
shell make
love
. make
- ,
,
"" .
``make love
'' make
love. make ,
( )
.
, , shell ? :
/home/larry# eat dirt
eat: command not found
/home/larry#
, shell
( ``eat
''),
, '
. ,
. (,
``mkae love
'' ``make love
'').
, , , . shell
/home/larry# exit
. , .
, .
"passwd"
( UNIX) , , , . : , , , , . , , , .
. , ,
my-paper
.
- .
, MS-DOS
;
( /
-
"") 256 .
. - .
"", .
,
. , ..
.
(
pathname
),
, ,
, , Larry , papers
,
: history-final
, english-lit
,
masters-thesis
. (
Larry ). ,
english-lit
, Larry :
papers/english-lit
, (/). . MS-DOS - , MS-DOS (\).
, .
, Larry papers
notes
. math-notes
cheat-sheet
. cheat-sheet
papers/notes/cheat-sheet
- , ,
.
() .
papers
notes
.
UNIX
, .
,
``/
'', " ".
/
:
/bin
, /etc
, /dev
, /usr
.
,
, ..
,
,
.
Larry ( cheat-sheet
history-final
)
Larry.
/home
. Larry
/home/larry
.
. 3.2.8 . , .
, shell,
.
,
.
( /home/larry
).
,
, .
/_____bin
|_dev
|_etc
|_home_____larry
| |_sam
|_lib
|_proc
|_tmp
|_usr__X386
|_bin
|_emacs
|_etc
|_g++-include
|_include
|_lib
|_local_____bin
| |_emacs
| |_etc
| |_lib
|_man
|_spool
|_src_____linux
|_tmp
3.1: () Unix
, Larry papers
, papers
history-final
. Larry
,
/home/larry# more /home/larry/papers/history-final
more .
Larry /home/larry
,
.
/home/larry# more papers/history-final
(
papers/final
) , ``/
'',
,
. (
- () - ..
).
(shell), .. ,
, (
) . Linux tcsh
bash
. tcsh
bash
,
(``~''). ,
/home/larry# more ~/papers/history-final
/home/larry# more /home/larry/papers/history-final
``~'' .
. ``~karl/letters
''
shell, ``/home/karl/letters
'' (
/home/karl
- karl).
;
``~'' - " ",
shell.
, , ,
(
MS-DOS). , make
Make
MAKE
. .
,
,
. -
cd
, (``change directory''). ,
Unix - .
cd
:
cd <directory>
<directory> - ,
. , ,
.
Larry ,
/home/larry# cd papers
/home/larry/papers#
, ,
( ).
papers
history-final
/home/larry/papers# more history-final
papers
,
/home/larry/papers# cd ..
/home/larry#
( ``cd
'' ``..
'').
``..
'' ,
( ) .
``.
'', .
/home/larry/papers# cd .
.
cd
.
,
/home/larry/papers# cd /home/karl
/home/karl#
cd
.
/home/karl# cd
/home/larry#
, - ,
:" ?"
,
ls
. ls (LiSt)
( ). ,
/home/larry# ls
Mail
letters
papers
/home/larry#
, Larry " "
: Mail
, letters
papers
.
,
: ?
-F
ls
,
.
/home/larry# ls -F
Mail/
letters/
papers/
/home/larry#
/ , ().
ls -F
( "-F
"
) ``*
'' .
,
. , ls -F
,
, "" , ..
.
, UNIX
.
``-
'', ls -F
.
-F
ls
,
.
ls
,
.
/home/larry# ls -F papers
english-lit
history-final
masters-thesis
notes/
/home/larry#
, , ,
/etc/
.
/home/larry# ls /etc
Images ftpusers lpc rc.new shells
adm getty magic rc0.d startcons
bcheckrc gettydefs motd rc1.d swapoff
brc group mount rc2.d swapon
brc~ inet mtab rc3.d syslog.conf
csh.cshrc init mtools rc4.d syslog.pid
csh.login init.d pac rc5.d syslogd.reload
default initrunlvl passwd rmt termcap
disktab inittab printcap rpc umount
fdprm inittab.old profile rpcinfo update
fstab issue psdatabase securetty utmp
ftpaccess lilo rc services wtmp
/home/larry#
( MS-DOS , 8 . ).
cd ..
'',
(/usr/bin
).
/home/larry# cd ..
/home# cd ..
/# cd usr
/usr# cd bin
/usr/bin#
, ,
, , cd /usr/bin
.
, ls
cd.
``Permission denied
''( ).
UNIX,
.
3.9.
, .
mkdir
. :
/home/larry# mkdir foo
/home/larry# ls -F
Mail/
foo/
letters/
papers/
/home/larry# cd foo
/home/larry/foo# ls
/home/larry/foo#
! . , , .
cp
(CoPy):
/home/larry/foo# cp /etc/termcap .
/home/larry/foo# cp /etc/shells .
/home/larry/foo# ls -F
shells termcap
/home/larry/foo# cp shells bells
/home/larry/foo# ls -F
bells shells termcap
/home/larry/foo#
cp
, ,
, .
.
'' .
mv
(MoVe)
. .
/home/larry/foo# mv termcap sells
/home/larry/foo# ls -F
bells sells shells
/home/larry/foo#
, termcap ,
sells
.
, .
.
! mv
cp
( ),
. ,
:
.
"" ,
ls
. rm
(ReMove).
/home/larry/foo# rm bells sells
/home/larry/foo# ls -F
shells
/home/larry/foo#
, shells
,
. , rm
, .
rm
rmdir
.
, .
- , .
more
cat
. more
"", ,
cat .
shells
,
/home/larry/foo# more shells
more
cat
etc/termcap/.
, .
``cat
'' (conCATenate)
, .
.
UNIX ,
"" - man
( ``manual pages''). man
, ,
. ,
ls
,
/home/larry# man ls
.
, , . , .
, . , .
,
, .
, .
. -
(the Linux Documentation Project -
Linux
. ).
-, shell
(alias), 3.2.4,
.
cd
, shell. Shell
, .
UNIX, , .
, ``-
''
, . ,
ls -l -F
, ls -lF
.
, , . , ( ). man .
,
, ,
``<file1> ... <fileN>''.
, cp
, ,
.
.
.
: cd <directory>
;
<directory>
- , (``.''
, ``..'' - ).
: cd ../foo
../foo
.
.
: ls <file1> ... <fileN>
<file1> ... <fileN>
,
.
: , .
: -F
(
), -l
( (``long'')
, ,
.. ).
: ls -lF /home/larry
/home/larry
.
() .
: cp <file1> ... <fileN> <destination>
<file1> ... <fileN>
,
<destination>
, .
: cp ../frog joe
../frog
joe
.
() .
.
, RENAME
MS-DOS.
: mv <file1> ... <fileN> <destination>
<file1> ... <fileN>
,
<destination>
,
.
: mv ../frog joe
../frog
joe
.
.
, UNIX ,
( MS-DOS, ""
).
: rm <file1> ... <fileN>
<file1> ... <fileN>
.
: -i
.
: rm -i /home/larry/joe /home/larry/frog
joe
frog
/home/larry
.
.
: mkdir <dir1> ... <dirN>
<dir1> ... <dirN>
.
: mkdir /home/larry/test
test
/home/larry
.
.
rmdir
.
: rmdir <dir1> ... <dirN>
<dir1> ... <dirN>
.
: rmdir /home/larry/papers
/home/larry/papers
, .
.
( "" - ,
, ).
: man <command>
<command>
,
.
: man ls
- ls
.
.
: more <file1> ... <fileN>
<file1> ... <fileN>
.
: more papers/history-final
papers/history-final
.
.
cat
: cat <file1> ... <fileN>
<file1> ... <fileN>
.
: cat letters/from-mdw
letters/from-mdw
.
.
: echo <arg1> ... <argN>
<arg1> ... <argN>
"" .
: echo "Hello world"
``Hello world
''.
(),
.
: grep <pattern> <file1> ... <fileN>
<pattern>
- (
) <file1> ... <fileN>
- ,
.
: grep loomer /etc/hosts
,
/etc/hosts
, ``loomer
''.
. - . , . ( . 3.2.8).
- (cd /
)
ls -F
. , , :
bin
, dev
, etc
,
home
, install
, lib
, mnt
, proc
, root
,
tmp
, user
, usr
var
.
( - ,
Linux ).
.
bin
- ``binaries'' (..
).
. ``ls -F/bin
''
.
, cp
,
ls
mv
. . ,
, cp
,
/bin/cp
.
ls -F
, , ( )
/bin
(``*
'').
, ,
3.3.2.
- dev
.
ls -F
.
"" /dev
-
,
, , .. ,
,
, /dev/mouse
.
, fd
- .
fd0
- , fd1
- .
, ,
, :
. , fd1H1440
high-density, 3.5"
1.
.
/dev/console/
, ..
, .
/dev/ttyS
/dev/cua
. , /dev/ttyS0
``COM1'' MS-DOS. /dev/cua
"" (``callout'') ,
.
hd
,
. /dev/hda
,
hda1
/dev/hda
.
sd
- SCSI-.
SCSI ,
/dev/hda
, /dev/sda
.
SCSI
st
, SCSI CD-ROM sr
.
lp
. /dev/lp0
``LPT1'' MS-DOS.
/dev/null
" " - ,
, .
,
/dev/null
. .
/dev/tty
" " (
/dev/tty1
VC, /dev/tty2
..
/dev/pty
,
"".
"". , ,
telnet /dev/pty
./etc
. /etc/passwd
( ),
/etc/rc
( ) ..
/sbin
, .
home
.
, /home/larry
-
``larry
''.
.
/lib
(shared library images).
, .
,
,
- /lib
.
.
/proc
-
" ",
, .
, ,
,
. 3.11.1.
,
.
/tmp
( ).
/usr
- .
,
,
.
, ,
, ,
/usr
.
,
. /usr
, , cp
ls
.
/usr
, .
/usr/X386
The X Window System,
. The X Window System -
,
, ""
. Microsoft Windows Macintosh
environments, X Windows .
/usr/X386
X Window, .
5.1.
/usr/bin
UNIX. ,
, , /bin
.
, /etc
,
. /usr/etc
. , ,
/usr/etc
,
, /etc
, .
/usr/include include-
. (
.h ( ``header'') '
, ,
. ,
/usr/include/sys
UNIX.
,
( , ),
stdio.h
, , printf()
.
/usr/g++-include
include-
C++ ( /usr/include
).
/usr/lib
-""
"" , /lib
.
"" ,
/usr/lib
,
/lib
, .
, /usr/lib
.
/usr/local
/usr
-
,
, . ,
, /usr/local
, .. /usr/local
UNIX.
, TeX ( ) Emacs
( ), .
.
"" .
( "man man"
). , /usr/man/man1
( )
1 /usr/man/cat1
1.
/usr/src
( )
. , /usr/src/linux
,
Linux.
/var
,
.
"" /usr
,
, ,
/var
.
:
/var/adm
,
, ,
, .
,
. 4.
/var/spool
,
. ,
,
/var/spool/mail
,
.
/var/spool/news
..
, UNIX - , . - , . , , ' , .
, , (shell). , UNIX ( ) - , . UNIX.
- , , ( ). , (shell-scripts), ' . MS-DOS ``batch-''. (shell) - , UNIX. 3.13.1.
UNIX.
- ``Bourne shell''(shell ) ``C shell'. Shell
( shell) ,
UNIX ( UNIX System III).
UNIX- shell /bin/sh
( sh
``shell''). C shell ,
- .
UNIX- /bin/csh
.
Linux .
, Shell (Bourne Again Shell)
``Bash'' (/bin/bash
) Tcsh (/bin/tcsh
).
Bash -
shell ,
C shell. Bash
shell,
, shell
Bash. ,
C shell, Linux Tcsh,
C shell.
, -
. shell
, Bash, -
C shell.
"" , cp
ls
,
shell .
, .
shell C shell.
( ,
bash
tcsh
).
Unix -
, ,
. , " "
(wildcards), , , ,
"n
".
``*''
. ,
``*
'' shell
, .
. , Larry frog
, joe
stuff
:
/home/larry# ls
frog joe stuff
/home/larry#
``o
'' ,
/home/larry# ls *o*
frog joe
/home/larry#
, ``*
''
.
``*
'' ,
.
/home/larry# ls *
frog joe stuff
/home/larry#
.
/home/larry# ls f*
frog
/home/larry# ls *ff
stuff
/home/larry# ls *f*
frog stuff
/home/larry# ls s*f
stuff
/home/larry#
``*
''
shell. : ,
ls
, ``*
'' .
Shell, , ,
.
/home/larry# ls *o*
shell
/home/larry# ls frog joe
``*
'' .
,
(``.
'').
"", .
, ls
``*
'' .
. ,
: ``.
'' -
``..'' - . ,
ls
, .
/home/larry# ls
frog joe stuff
/home/larry#
-a
ls
,
, ``.
'':
/home/larry# ls -a
. .. .bash_profile .bashrc frog joe
stuff
/home/larry#
, ``.
'' ``..
'', ,
"" - .bash_profile
.bashrc
.
larry .
3.13.3.
, ``*
'' ,
, , ``.
''
.
/home/larry# ls *
frog joe stuff
/home/larry#
: ``*
''
, ``.
'',
``.
'' ``..
''.
.
``?''. ``?
''
. ``ls ?
''
, , ``ls termca?
''
``termcap
'', ``termcap.backup
''.
:
/home/larry# ls j?e
joe
/home/larry# ls f??g
frog
/home/larry# ls ????f
stuff
/home/larry#
,
. 3.4 ,
cp
mv
. ,
/home/larry# cp /etc/s* /home/larry
/etc
, ``s''
/home/larry
. cp
cp <file1> ... <fileN> <destination>
<file1> ... <fileN>
- ,
<destination>
,
. mv .
,
, , <destination>
.
.
UNIX ( ) . ( ``stdin'' ``stdout'' ). shell , , - .
cat
. cat
,
stdout.
/home/larry/papers# cat history-final masters-thesis
history-final
,
masters-thesis
.
cat , stdin stdout. .
/home/larry/papers# cat
Hello there.
Hello there.
Bye.
Bye.
[ctrl-D]
/home/larry/papers#
, ,
, cat .
,
, - EOT
(End-Of-Text).
. sort ( stdin, , stdout. .
/home/larry/papers# sort
bananas
carrots
apples
[ctrl-D]
apples
bananas
carrots
/home/larry/papers#
, , ... UNIX ?
, , , - . Shell , ``>''. .
/home/larry/papers# sort > shopping-list
bananas
carrots
apples
[ctrl-D]
/home/larry/papers#
, sort
,
shopping-list
( ). .
/home/larry/papers# cat shopping-list
apples
bananas
carrots
/home/larry/papers#
()
, ! ,
items
.
, ,
,
.
/home/larry/papers# sort items > shopping-list
/home/larry/papers# cat shopping-list
apples
bananas
carrots
/home/larry/papers#
-. , , ``<''.
/home/larry/papers# sort < items
apples
bananas
carrots
/home/larry/papers#
, sort < items
sort items
,
:
sort < items
, items
. shell . sort
(items
)
, .
. , ,
,
-
.
. sort
- :
. cat
-
: ,
, , .
, sort
. , -
,
. , , ,
, ,
ls
? -r
,
, .
, :
/home/larry/papers# ls
english-list
history-final
masters-thesis
notes
/home/larry/papers# ls > file-list
/home/larry/papers# sort -r file-list
notes
masters-thesis
history-final
english-list
/home/larry/papers#
ls
,
sort -r
.
ls
.
(pipeline)
(.
: "",
"pipeline").
-
shell,
, stdout
stdin .
stdout ls
stdin sort.
``|'' :
/home/larry/papers# ls | sort -r
notes
masters-thesis
history-final
english-list
/home/larry/papers#
, , . .
/home/larry/papers# ls /usr/bin
, , . /usr/bin more.
/home/larry/papers# ls /usr/bin | more
.
! , . head , (, ). , , :
/home/larry/papers# ls | sort -r | head -1
notes
/home/larry/papers#
head -1
(
, ls
).
``>'' , ( , ),
/home/larry/papers# ls > file-list
file-list
.
``>>'',
( ,
).
/home/larry/papers# ls >> file-list
ls file-list
.
, , , shell, shell ``>'', ``>>'' ``|'' , .
UNIX - , , UNIX , , . . , Larry , Larry .
UNIX . Larry , , . , .
' , . , , , . . , .
. , UNIX
,
,
,
.
- ( bin
admin
),
.
.
: (read), (write) (execute). : , , , () .
, -
(, , ls
).
.
,
. ,
( ,
).
cd.
,
. ls
-l
"" ,
.
/home/larry/foo# ls -l stuff
-rw-r--r-- 1 larry users 505 Mar 13 19:05 stuff
/home/larry/foo#
.
- (larry
) -
(users
).
, (stuff
),
.
larry
, users
.
. -rw-r--r--
, .
(``-
'')
. ``-
'' , (
-
). (``rw-
'')
, larry
. ``r
''
``read''(), ``w
'' - ``write''(). larry
stuff
.
,
``execute'' -
``x
''. ``-
'',
Larry . ,
stuff
. ,
Larry ,
, .
.
r--
. users
.
``r
'',
.
r--
,
.
.
, . .
. .
.
, ,
,
. , -rwxrwxrwx
,
,
, .
, Larry
,
/home/larry
drwx------
.
, ,
.
Larry .
, , , , .
UNIX
. -rw-r--r--
,
,
.
drwxr-xr-x
,
.
.
. ,
-rw-------
.
drwx------
.
chmod
()
.
.
:
chmod {a,u,g,o}{+,-}{r,w,x} <filenames>
, all (), user
(), group () other ().
, (+
), (-
).
, : read, write
execute. :
stuff.
, (a - ).
, .
(read, write execute).
(read, write execute) (other).
.
,
.
ls -i
.
ln
. , , foo
.
ls -i
.
# ls -i foo
22192 foo
#
foo
22192.
bar:
# ln foo bar
ls -i
,
.
# ls -i foo bar
22192 bar 22192 foo
#
, foo
bar
. , -
foo
, bar
.
, (hard links), . , ; ( ) .
rm
,
.
# rm foo
, foo
; bar
. ,
.
, rm
. , , rm
; ,
, .
ls -l
(
)
# ls -l foo bar
-rw-r--r-- 2 root root 12 Aug 5 16:51 bar
-rw-r--r-- 2 root root 12 Aug 5 16:50 foo
#
``2'' .
,
"-". ,
: ``.
'' (,
) ``..
'' (,
). (/
)
``..
'' /
.
, , . , .
ln -s
. ,
# ln -s foo bar
bar
, foo
.
ls -i
, ,
.
# ls -i foo bar
22195 bar 22192 foo
#
, ls -l
, , bar
foo
.
# ls -l foo bar
lrwxrwxrwx 1 root root 3 Aug 5 16:51 bar -> foo
-rw-r--r-- 1 root root 12 Aug 5 16:50 foo
#
( , rwxrwxrwx
). ,
, ,
, (
foo
).
, , . , , ; . , . , . , , ; , .
Linux.
/lib
.
4.7.2.
(job control)
,
, (Bash Tcsh).
, , ,
, . -
. ps
. :
/home/larry# ps
PID TT STAT TIME COMMAND
24 3 S 0:03 (bash)
161 3 R 0:00 ps
/home/larry#
PID (Process IDentificator), , .
(COMMAND) .
, Larry. (
. ``ps -aux
''
).
bash
( ,
Larry) ps
. , bash
ps
. bash ps
,
Larry . ps
( ,
), bash
,
.
shell . . , "", (job control)- shell, .
, shell . , , , . ? , - . , shell, - . , , . . .
, . . , , , . (, , , , 3.8). , , ( - ) , .
. - , . , , . . , .
. - , . , , , . - , .
, ,
. (
,
. yes
-
, "y"
. ( .
"y" ,
yes
"no" , "y"
). .
/home/larry# yes
y
y
y
y
y
. ,
; /dev/null
. , /dev/null
"
" . .
/home/larry# yes > /dev/null
, . ,
shell . ,
, "y" /dev/null
.
, .
, , yes
,
shell, .
yes
, ,
.
,
``&
''.
/home/larry# yes > /dev/null &;
[1] 164
/home/larry#
, .
``yes
?
``yes
. Shell
. "yes" -
, ,
1. ``164'' - (PID);
, .
,
.
yes
,
"y"- /dev/null
.
, shell -
jobs
.
/home/larry# jobs
[1]+ Running yes >/dev/null &
/home/larry#
, .
ps
, , .
kill
.
,
. 1,
/home/larry# kill %1
. (``%'').
, , jobs
:
/home/larry# jobs
[1]+ Terminated yes >/dev/null
/home/larry#
,
jobs
, .
, (PID), , ( ). PID 164,
/home/larry# kill 164
/home/larry# kill %1
``%
'',
.
. ( ), .
"":
/home/larry# yes > /dev/null
, shell.
, ,
/home/larry# yes > /dev/null
[ctrl-Z]
[1]+ Stopped yes >/dev/null
/home/larry#
, . . , .
fg
(``foreground'' - ).
/home/larry# fg
yes >/dev/null
Shell ,
,
. bg
(``background'' - ,
), .
,
``&
''.
/home/larry# bg
[1]+ yes >/dev/null &
/home/larry#
. jobs ,
yes ,
kill
, .
? fg
,
, .
. , , , ( , ). , . - , , - . , :
/home/larry# yes &
stdout /dev/null
, "y"
(
. fg
bg
,
( ``+
''
, jobs).
,
, ,
fg
bg,
/home/larry# fg %2
( 2)
/home/larry# bg %3
( 3).
. , ,
/home/larry# %2
/home/larry# fg %2
, , shell.
fg
, bg
jobs
- shell.
- shell,
, .
, , Bash Tcsh. , Linux .
, ,
, , ,
- . Linux
, ,
UNIX - vi
(``visual editor''). vi
- .
UNIX
, - .
, .
Emacs -
,
UNIX. , Emacs
LISP
( ``Eliza''-
). , Emacs
,
. vi
, , , , ,
. ,
, . .
- vi
.
, , ,
. ,
.
vi
.
, .
vi
- .
. ,
``x
'' ,
, .
. ,
, .
. vi
, ,
.
``i
'' (``insert'' - )
. ,
.
- ,
.
. ,
``:'' ,
, ``wq
''
( (write) (quit) vi), ``q!
'' (
vi ).
vi
,
.
,
vi
.
``screens
'', ,
,
( ).
vi
vi <filename>
<filename>
- .
vi
,
/home/larry# vi test
test
.
____________________________________________________________________
|~_ |
|~ |
|~ |
|~ |
|~ |
|"test"_[New_file]__________________________________________________|
``~'' , .
; ,
,
____________________________________________________________________
|Now is the time for all good men to come to the aid of the party._ |
|~ |
|~ |
|~ |
|~ |
|~__________________________________________________________________|
,
(
. , , "" "" , vi .
,
i
. , a
,
,
.
``good'' ``men''.
____________________________________________________________________
|Now is the time for all good_men to come to the aid of the party. |
|~ |
|~ |
|~ |
|~ |
|~__________________________________________________________________|
wo
'',
____________________________________________________________________
|Now is the time for all good women to come to the aid of the party.|
|~ |
|~ |
|~ |
|~ |
|~__________________________________________________________________|
, ,
``''. ,
____________________________________________________________________
|Now is the time for all good women to come to the aid of the party.|
|Afterwards, we'll go out for pizza and beer._ |
|~ |
|~ |
|~ |
|~__________________________________________________________________|
,
( , i
, a o )
( ,
"x
"
.
____________________________________________________________________
|Now is the time for all good women to come to the aid of the party.|
|Afterwards, we'll go out for pizza and _ |
|~ |
|~ |
|~ |
|~__________________________________________________________________|
____________________________________________________________________
|Now is the time for all good women to come to the aid of the party.|
|Afterwards, we'll go out for pizza and Diet Coke._ |
|~ |
|~ |
|~ |
|~__________________________________________________________________|
, dd
(..
dd
,
____________________________________________________________________
|Now is the time for all good women to come to the aid of the party.|
|~ |
|~ |
|~ |
|~ |
|~__________________________________________________________________|
, ,
dw
. ``good''
dw
.
____________________________________________________________________
|Now is the time for all women to come to the aid of the party. |
|~ |
|~ |
|~ |
|~ |
|~__________________________________________________________________|
, R
.
``party'',
____________________________________________________________________
|Now is the time for all women to come to the aid of the hungry._ |
|~ |
|~ |
|~ |
|~ |
|~__________________________________________________________________|
R
i
a
, R
.
r
, .
, ``Now''
r
, C
, :
____________________________________________________________________
|Cow is the time for all women to come to the aid of the hungry._ |
|~ |
|~ |
|~ |
|~ |
|~__________________________________________________________________|
``˜
'' , :
. ,
``o'' ``Cow''
____________________________________________________________________
|COW IS THE TIME FOR ALL WOMEN TO COME TO THE AID OF THE HUNGRY. |
|~ |
|~ |
|~ |
|~ |
|~__________________________________________________________________|
,
. h
, j
,
k
, l
, , .
, ( - )
.
w
; b
-
.
0
( )
, $
.
.
, ,
G
. ,
10G
. , ( ),
1G
.
,
. , d$
; dG
..
vi
:q!
.
``:
'', ,
.
____________________________________________________________________
|COW IS THE TIME FOR ALL WOMEN TO COME TO THE AID OF THE HUNGRY. |
|~ |
|~ |
|~ |
|~ |
|~ |
|:__________________________________________________________________|
. - q!
,
vi
. :wq
() ,
vi
. ZZ
( ,
`:
'')
:wq
. , vi
, :w
.
, ,
:e
. , test
foo
,
____________________________________________________________________
|COW IS THE TIME FOR ALL WOMEN TO COME TO THE AID OF THE HUNGRY. |
|~ |
|~ |
|~ |
|~ |
|~ |
|:e foo_____________________________________________________________|
:e , .
____________________________________________________________________
|No_write_since_last_change_(":edit!"_overrides)____________________|
, vi
, .
:w
, ,
:e
____________________________________________________________________
|COW IS THE TIME FOR ALL WOMEN TO COME TO THE AID OF THE HUNGRY. |
|~ |
|~ |
|~ |
|~ |
|~ |
|:e! foo_____________________________________________________________|
``!
'' vi
, -
,
.
:r
,
. ,
:r foo.txt
foo.txt
.
vi
. :r!
:r
,
, , . ,
:r! ls -F
____________________________________________________________________
|COW IS THE TIME FOR ALL WOMEN TO COME TO THE AID OF THE HUNGRY. |
|letters/ |
|misc/ |
|papers/_ |
|~ |
|~__________________________________________________________________|
a
, vi
,
:! ls -F
ls -F
,
, .
:shell
vi
shell, "" vi
. shell ( exit
)
vi
.
vi
(
UNIX- ),
vi
. vi
- " "
ex
; ex
vi
.
vi
ex
.
Shell . , shell , - . shell , UNIX shell.
,
. , Tcsh
, , shell
.
, ,
shell
, ' . ,
/home/larry# cat chapter1 chapter2 chapter3 > book
/home/larry# wc -l book
/home/larry# lp book
' , : chapter1
,
chapter2
, chapter3
book
.
( book
)
, , lp
.
, ( ). shell 3.13.1. , ,
#!/bin/sh
# A shell script to create and print the book
cat chapter1 chapter2 chapter3 > book
wc -l book
lp book
makebook
,
/home/larry# makebook
. shell -
,
emacs
vi
. (vi
3.12)
.
``#!
bin/sh/'' ,
shell, .
bin/sh/,
bin/sh/ - shell. ?
UNIX
bin/sh/ - shell ,
bash
.
shell , bin/sh/,
,
shell ( , , C shell).
shell ,
Tcsh ( - C shell)
.
.
``#
'' -
shell
.
- , . Shell , shell.
. ,
, .
/home/larry# chmod u+x makebook
shell- makebook
.
Shell ,
. - ,
.
! , Tcsh, , C shell,
,
. shell
. (
``=
'' ), ,
``$
'',
/home/larry# foo=``hello there''
foo ``hello there
''.
,
``$
''.
/home/larry# echo $foo
hello there
/home/larry#
,
/home/larry# echo ``hello there''
hello there
/home/larry#
shell. , shell . ; , , , . set shell.
Shell . -
,
. shell
export
.
! Bash Tcsh.
Tcsh
( setenv
).
Tcsh.
UNIX. , .
. PAGER
man. ,
man .
PAGER
,
more (
).
PAGER
``cat
''.
, , more.
/home/larry# PAGER=cat
PAGER
.
/home/larry# export PAGER
man ls
.
() .
, PAGER
``more
'',
more.
/home/larry# PAGER=more
,
export
PAGER
.
; ,
, .
, -
. , man ,
PAGER
.
, ,
EDITOR
.
. HOME
.
/home/larry/papers# echo $HOME /home/larry
- PS1
,
shell. ,
/home/larry# PS1=``Your command, please: '' Your command, please:
( ,
``#
''), :
Your command, please: PS1=``\w# '' /home/larry#
bash
,
.
ls
, shell
() ls
?
ls
/bin/ls
. shell
PATH
("")
.
, PATH
/bin:/usr/bin:/usr/local/bin:.
( shell
), ``:
''.
ls
, shell
/bin/ls
, /usr/bin/ls
..
, PATH
. ,
/home/larry# cp foo bar
shell PATH
foo
bar
- ,
. shell PATH
cp.
; ,
, .
,
/usr/bin
, /bin
/usr/local/bin
.
,
( /usr/bin/cp
),
PATH
, ,
shell .
, PATH
``.
'',
" ".
shell-
, (
./makebook
). PATH
, shell
,
.
shell-, , , shell . , shell .
- ,
.
. ,
mail
,
.
Bash, Tcsh shell
( ) shell.
shell ;
shell, .
shell , vi
,
() shell. ,
shell-,
shell.
, Bash: /etc/profile
( ,
bash
,
), $HOME/.bash_profile
(
) $HOME/.bashrc
(
bash
). .bash_profile
, .profile
.
Tcsh :
/etc/csh.login
( tcsh
), $HOME/.tcshrc
(
tcsh
)
$HOME/.login
( .tcshrc
). .tcshrc
, .cshrc
.
, ,
shell. shell
, .
bash
tcsh
.
, , . , Linux - . . , - Linux , . - . , , .
- UNIX. UNIX , - , . UNIX A.