\documentclass[letterpaper,english]{article}
\nonstopmode
\akai
\usepackage{linuxdoc-sgml}
\usepackage{qwertz}
\usepackage{url}
\usepackage[latin1]{inputenc}
\usepackage{t1enc}
\usepackage[english]{babel}
\usepackage{epsfig}
\usepackage{null}
\def\addbibtoc{
\addcontentsline{toc}{section}{\numberline{\mbox{}}\relax\bibname}
}%end-preamble
\setcounter{page}{1}
\title{ÈçºÎ´Ó VMS ×ªÒÆµ½ Linux (From VMS to Linux HOWTO)}
\author{By Guido Gonzato, \nameurl{guido ``at'' ibogeo.df.unibo.it}{},
and Mike Miller, \nameurl{miller5@uiuc.edu}{},
ÒëÕß£º·åÖÛ}
\date{v1.1.3, 17 September 1999}
\abstract{Õâ·Ý HOWTO Ö÷ÒªÊÇÕë¶ÔÄÇÐ©ÒÑ¾­ÓÃ¹ý VMX ÏµÍ³£¬¶øÏÖÔÚ¿ÉÄÜÒòÐèÒª¶ø×ªÐÍÊ¹ÓÃ Linux ×÷ÒµÏµÍ³µÄÈË¡£Ï£Íû½åÓÉ±È½ÏÁ½Õß×÷ÒµÏµÍ³¼äÖ¸ÁîµÄ²îÒì£¬¶øÑ­Ðò½¥½øµÄ´øÁìÄú½øÈë Linux µÄÊÀ½ç¡£}


\begin{document}
\maketitle
\tableofcontents

\section{¼ò½é \label{Introduction}}


\subsection{ÎªºÎÒªÊ¹ÓÃ Linux ?}



ÄúÔø¾­Ìý¹ý UNIX ¼èÉîÄÑ¶®±ãÎ·¾å¶ª¿ª VMS Âð£¿±ð·³ÄÕ£¬Linux£¬×îºÃµÄ UNIX ÏàÈÝ»úÖÖÖ®Ò»£¬
Ò»µãÒ²²»»á±È VMS ÄÑÊ¹ÓÃ£»Ïà·´µÄ£¬ÎÒ·¢ÏÖ Linux ±È VMS ¸üÈÝÒ×ÉÏÊÖ¡£ËäÈ»£¬VMS ÃÔ¿ÉÄÜ²»ÒÔÎªÈ»£¬
µ«ÊÇ£¬¾­¹ýÐí¶àÈËµÄ½¨ÒéÊÇ£ºLinux È·ÊµÊÇ±È VMS ¸üÓÐÐ§Á¦ÇÒ¸üÊÇ¶à¹¦¡£

Linux ºÍ VMS Á½Õß¶¼ÊÇºÜºÃµÄ×÷ÒµÏµÍ³£¬¶øÇÒ±¾ÖÊÉÏ¶¼¿ÉÒÔ·Ç³£ÓÐÐ§ÂÊµÄÍê³ÉÏàÍ¬µÄ×÷Òµ¡£
µ«ÊÇ£¬Linux ÓÐÒ»Ð©·Ç³£ÎüÒýÈËµÄÌØÉ«£¬¶øÊ¹µÃËý³ÉÎª VMS ºÜºÃµÄÁíÒ»¸öÑ¡Ôñ¡£²¢ÇÒ£¬
Linux ¿ÉÒÔÔÚ¸öÈËµçÄÔ (PC) ÉÏÊ¹ÓÃ£¬¶ø VMS È´²»ÐÐ¡£ÏÖÔÚÈÎºÎÒ»Ì¨±¼ÌÚ(Pentium)µÄµçÄÔ£¬
Ê¹ÓÃ Linux Îª×÷ÒµÏµÍ³µÄÐ§ÄÜ¸ü¿ÉÔ¶Ô¶µØÊ¤¹ý VMS µÄ»úÆ÷¡£¸üÃÔÈËµÄÊÇ£¬ÏÖÔÚÒÔÒ»°ãµÄÏÔÊ¾¿¨£¬
¾Í¿ÉÒÔÓÐ·Ç³£ÓÅÐãµÄÊÓ´°Í¼ÐÎ½çÃæ¡£¼¸ºõ×ÜÊÇ¿ì¹ýÄÇÐ©×¨ÓÃµÄµçÄÔ¡£

ÎÒÏë£¬ÄúÓ¦¸ÃÊÇ´óÑ§ÀïµÄÑÐ¾¿ÈËÔ±»òÊÇÑ§Éú£¬²¢ÇÒÄúÃ¿ÌìÊ¹ÓÃ VMS À´Íê³ÉÏÂÁÐµÄ¼¸¼þÊÂ£º

\begin{itemize}
\item  Ê¹ÓÃ TeX/LaTeX À´Ð´±¨¸æ;
\item  Ê¹ÓÃ Fortran À´Ð´³ÌÊ½;
\item  ×÷Ò»Ð©Í¼ÐÎÎÄ¼þ;
\item  ÉÏÍøÊ¹ÓÃÄ³Ð©·þÎñ;
\item  ¼°ÆäËûµÈµÈ.
\end{itemize}


ÔÚÏÂÃæµÄÕÂ½ÚÖÐ£¬ÎÒ½«ÀûÓÃÄúÔÚ VMS ÉÏµÄ¾­Ñé£¬½éÉÜÈçºÎÔÚ Linux ÉÏÍê³ÉÉÏÁÐµÄÃ¿Ò»¼þÊÂ¡£
Ê×ÒªÊÂÎï£º

\begin{itemize}
\item  ÇëÈ·¶¨ Linux ºÍ X Window ¶¼ÒÑ¾­°²×°ÍêÈ«;
\item  ÓÐÒ»Î»ÏµÍ³¹ÜÀíÔ±¿ÉÒÔ×÷Îª¼¼ÊõÖ¸µ¼¡££¨ÇëÕÒËûÃÇ°ïÃ¦£¬Çë²»ÒªÀ´ÕÒÎÒ ;-) £©;
\item  ÄúÏµÍ³ÉÏµÄ shell ¿ÉÒÔÊÇ bash £¨ÇëÑ¯ÎÊÄúµÄÏµÍ³¹ÜÀíÔ±£©;
\end{itemize}


Çë×¢Òâ£¬Õâ·Ý HOWTO »¹²»×ã¹»Ê¹ÄúÈ«²¿ÁË½â Linux µÄ¾«Ëè¡£ËýÖ»°üº¬ÁË½öÓÐµÄÒ»Ð©ÈëÃÅµÄ±ØÒªÖªÊ¶¶øÒÑ¡£
ÄúÓ¦¸ÃÑ§Ï°¸ü¶àµÄ Linux µÄÖªÊ¶£¬²¢ÇÒ³ä·ÖµÄÀûÓÃËý¡£(advanced {\ttfamily bash} 
features, programming, regular expressions...). ´ÓÏÖÔÚ¿ªÊ¼£¬RMP µÄÒâË¼ÊÇ
`please read the man pages for further details'. ÔÚ Linux ÉÏ£¬man pages ÆäÊµ¾ÍÊÇ help µÄÒâË¼¡£

The Linux Documentation Project ÎÄ¼þ¿ÉÒÔÔÚ \nameurl{ftp://sunsite.unc.edu:/pub/Linux/docs/LDP}{}, »ñµÃ¡£¶øÕâÒ²ÊÇÖØÒªÑ¶Ï¢µÄÀ´Ô´¡£
ÎÒ½¨ÒéÄú¿ÉÒÔÔÄ¶ÁÓÉ Larry Greenfield Ð´µÄ ``Linux User
Guide'' Êé¡£---ÕâÊÇÒ»±¾·Ç³£ÊÊºÏ³õÑ§ÕßµÄÈëÃÅÊé¡£

ÏÖÔÚÈÃÎÒÃÇ²½ÈëÕýÌâ°É£º




\subsection{Ö¸ÁîµÄ±È½ÏºÍµµ°¸¸ñÊ½}



Õâ¸ö±íÁÐ³ö VMS ºÍ Linux ÖÐ³£ÓÃµÄÖ¸Áî¼¯¡£ÇëÀÎ¼ÇÔÚÐÄ£¬ÆäÓï·¨Ò²½«´ó´óµÄ²»Í¬¡£
ÏêÏ¸Ï¸½ÚÇë²Î¿¼Ïà¹ØÕÂ½Ú¡£

\begin{tscreen}
\begin{verbatim}
VMS                             Linux                   ×¢ÒâÊÂÏî(Linux ²¿·Ý)
------------------------------------------------------------------------------

@COMMAND                        command                 ±ØÐë¿É±»Ö´ÐÐ
COPY file1 file2                cp file1 file2
CREATE/DIR [.dirname]           mkdir dirname           Ò»´ÎÖ»ÄÜ½¨Ò»¸öÄ¿Â¼
CREATE/DIR [.dir1.dir2]         mkdirhier dir/name
DELETE filename                 rm filename
DIFF file1 file2                diff -c file1 file2
DIRECTORY                       ls
DIRECTORY [...]file             find . -name file
DIRECTORY/FULL                  ls -al
EDIT filename                   vi filename,            Äú¿ÉÄÜ²»»áÏ²»¶Ê¹ÓÃ vi
                                emacs filename,         EDT compatible
                                jed filename            ditto---my favourite
FORTRAN prog.for                g77 prog.f,             ²»ÐèÒª×÷ LINK
                                f77 prog.f,
                                fort77 prog.f
HELP command                    man command             must specify `command'
                                info command            ditto
LATEX file.tex                  latex file.tex
LOGIN.COM                       .bash_profile,          `hidden' file
                                .bashrc                 ditto
LOGOUT.COM                      .bash_logout            ditto
MAIL                            mail,                   ×îÔ­Ê¼µÄ email ³ÌÊ½
                                elm,                    ±È mail ºÃ¡£
                                pine                    ²»´í£¬µ«ÊÇ¶¼Ö»ÄÜ´¦ÀíÎÄ×Ö¡£
PRINT file.ps                   lpr file.ps
PRINT/QUEUE=laser file.ps       lpr -Plaser file.ps
PHONE user                      talk user
RENAME file1 file2              mv file1 file2          not for multiple files
RUN progname                    progname
SEARCH file "pattern"           grep pattern file
SET DEFAULT [-]                 cd ..
SET DEFAULT [.dir.name]         cd dir/name
SET HOST hostname               telnet hostname,        ²»Ì«ÏàÍ¬
                                rlogin hostname
SET FILE/OWNER_UIC=joe          chown joe file          ÍêÈ«²»ÏàÍ¬
SET NOBROADCAST                 mesg
SET PASSWORD                    passwd
SET PROT=(perm) file            chmod perm file         ÍêÈ«²»ÏàÍ¬
SET TERMINAL                    export TERM=            Óï·¨²»Í¬
SHOW DEFAULT                    pwd
SHOW DEVICE                     du, df
SHOW ENTRY                      lpq
SHOW PROCESS                    ps -ax
SHOW QUEUE                      lpq
SHOW SYSTEM                     top
SHOW TIME                       date
SHOW USERS                      w
STOP                            kill
STOP/QUEUE                      kill,                   Õë¶Ô processes
                                lprm                    Õë¶Ô print queues
SUBMIT command                  command &
SUBMIT/AFTER=time command       at time command
TEX file.tex                    tex file.tex
TYPE/PAGE file                  more file
                                less file               much better
\end{verbatim}
\end{tscreen}


µ±È»£¬Õâ²»Ö»ÊÇÖ¸ÁîµÄÃû³Æ²»Ò»Ñù¶øÒÑ£¬Çë¼ÌÐø¶ÁÖ®¡£






\section{Å£µ¶Ð¡ÊÔ \label{Short Intro}}



ÕâÐ©¾ø¶ÔÊÇÄúÔÚµÚÒ»´ÎµÇÈëÏµÍ³Ç°±ØÐëÖªµÀµÄÒ»Ð©ÊÂÇé£¬·ÅÇáËÉ£¬²»»áÌ«¸´ÔÓµÄ¡£




\subsection{µµ°¸}



\begin{itemize}
\item  ÔÚ VMS ÉÏµÄµµÃûµÄ±íÊ¾·¨ÊÇ {\ttfamily filename.extension;version}¡£
µ«ÊÇÔÚ Linux ÉÏ£¬µµ°¸µÄ°æ±¾ºÅÂë½«²»»áÔÙ³öÏÖ£¨ÖØÒªµÄÏÞÖÆ£¬Çë²ÎÔÄ \ref{Numbered Backups Under Linux} {(Linux ÉÏµÄµµ°¸°æ±¾)}); 
µµÃû×î³£Ö»ÄÜÓÐ 255 ¸ö×ÖÔª£¬µµÃûÖÐ¿ÉÒÔ³öÏÖºÜ¶à¸öµã ¡°£®¡±¡£ÀýÈç£º{\ttfamily This.is\_a\_FILEname.txt}.
\item  Linux ¶ÔµµÃûµÄ´óÐ¡Ð´ÊÇÓÐ·Ö±ðµÄ£º 
{\ttfamily FILENAME.txt} ºÍ {\ttfamily filename.txt} ÊÇÁ½¸öÍêÈ«²»Ò»ÑùµÄµµÃû; 
{\ttfamily ls} ÊÇÒ»¸öÖ¸Áî£¬¿ÉÒÔ±»Ö´ÐÐ£¬µ«ÊÇ {\ttfamily LS} È´²»ÊÇÖ¸Áî£¬»á³öÏÖ´íÎóÑ¶Ï¢¡£
\item  µµÃûµÄµÚÒ»¸ö×ÖÔªÈç¹ûÊÇÒ»µã¡°£®¡±£¬ÔòÕâ¸öµµÃûÊÇ`Òþ²Øµµ' £¨Ò²¾ÍÊÇËµ£¬Èç¹û²»¼ÓÌØ±ðÖ¸ÁîµÄ»°£¬Ò»°ãµÄ ls ½«²»»áÏÔÊ¾³öÕâÐ©Òþ²Øµµ£©£¬
¶øµµ°¸µÄ½áÎ²Èç¹ûÊÇ¡°òÇò¾ºÅ¡±'{\ttfamily \~{}}' £¬Õâ±íÊ¾±¸·Ýµµ°¸£¨»òÊÇÔÝ´æµµ£©£®

\end{itemize}


ÏÖÔÚ£¬ÏÂ±íÕûÀí³ö°Ñ VMS µÄÖ¸Áî¶ÔÓ¦µ½ Linux ÉÏµÄÖ¸Áî£®

\begin{tscreen}
\begin{verbatim}

VMS                                     Linux
---------------------------------------------------------------------

$ COPY file1.txt file2.txt              $ cp file1.txt file2.txt
$ COPY [.dir]file.txt []                $ cp dir/file.txt .
$ COPY [.dir]file.txt [-]               $ cp dir/file.txt ..
$ DELETE *.dat;*                        $ rm *dat
$ DIFF file1 file2                      $ diff -c file1 file2
$ PRINT file                            $ lpr file
$ PRINT/queue=queuename file            $ lpr -Pprintername file
$ SEARCH *.tex;* "geology"              $ grep geology *tex
\end{verbatim}
\end{tscreen}


ÆäËû¶Ôì¶Ä¿Â¼·½ÃæµÄÖ¸Áî£¬Çë¼ûÒ»ÕÂ½Ú£»µµ°¸µÄÊôÐÔ£¨protections, ownership...£©Çë²ÎÕÕ \ref{Advanced Topics} {(½ø½×)}¡£




\subsection{Ä¿Â¼}



\begin{itemize}
\item  ÔÚÍ¬Ò»¸ö½Úµã£¨node£©»òÊÇ×°ÖÃ£¨device£©£¬ÔÚ VMS ÉÏ£¬Ä¿Â¼µÄÐÎÊ½¿´ÆðÀ´Ó¦¸ÃÏñÕâÑù£º{\ttfamily [top.dir.subdir]}; 
ÔÚ Linux ÉÏÊÇ£º{\ttfamily /top/dir/subdir/}. ¶ÔÉÏ²ãµÄÄ¿Â¼ÎÒÃÇ³ÆÎª¡°¸ùÄ¿Â¼¡±£¨{\ttfamily /}£©; 
ËùÓÐ×ÓÄ¿Â¼£¬¶¼ÊÇÓÉ¸ùÄ¿Â¼ÏòÏÂÑÓÉì£º {\ttfamily /bin},
{\ttfamily /usr}, {\ttfamily /tmp}, {\ttfamily /etc}, µÈµÈ¡£
\item  Ä¿Â¼Ãû³Æ {\ttfamily /home} ÊÇ´æ·ÅÊ¹ÓÃÕßÄ¿Â¼£¬ÀýÈç£º{\ttfamily /home/guido}, {\ttfamily /home/warner}, µÈµÈ¡£
µ±Ê¹ÓÃÕßµÇÈëµÄÊ±ºò£¬ËýÃÇ»áµÇÈëµ½ËýÃÇ×Ô¼ºÓµÓÐµÄÊ¹ÓÃÕßÄ¿Â¼£»ÕâºÍ {\ttfamily SYS\$LOGIN} ÊÇÓÐÒìÇúÍ¬¹¤Ö®Ãî¡£
ÇÐ»»µ½Ö»ÓÃÕßÄ¿Â¼ÓÐ¸ö·½±ãµÄ·½·¨£ºÊ¹ÓÃ¡°òÇò¾ºÅ¡±'{\ttfamily \~{}}'¡£
ËùÒÔ£¬{\ttfamily cd \~{}/tmp} ºÍ {\ttfamily cd /home/guido/tmp} ÊÇÒ»ÑùµÄÒâË¼¡£
\item  Ä¿Â¼Ãû³ÆµÄÃüÃû·½Ê½ºÍµµ°¸Ãû³ÆµÄÃüÃû·½Ê½ÏàÍ¬¡£ ÔÙÕß£¬
Ã¿¸öÄ¿Â¼¶¼»áÓÐÁ½¸öÌØ±ðµÄÄ¿Â¼Ãû³Æ£ºÒ»¸öÊÇ£º{\ttfamily .} £¬±íÊ¾Ö¸µ½×Ô¼ºµÄÄ¿Â¼¡£ (Ïñ {\ttfamily []})£»
Ò»¸öÊÇ£º{\ttfamily ..} £¬±íÊ¾Ö¸µ½ÉÏÒ»²ãÄ¿Â¼ (Ïñ {\ttfamily [-]})¡£
\end{itemize}
 

ÈÃÎÒÃÇÀ´¿´¿´ÆäËûµÄÀý×Ó£º

\begin{tscreen}
\begin{verbatim}

VMS                                     Linux
---------------------------------------------------------------------

$ CREATE/DIR [.dirname]                 $ mkdir dirname
$ CREATE/DIR [.dir1.dir2.dir3]          $ mkdirhier dir1/dir2/dir3
   n/a                                  $ rmdir dirname
                                        (if dirname is empty)
                                        $ rm -R dirname
$ DIRECTORY                             $ ls
$ DIRECTORY [...]file.*;*               $ find . -name "file*"
$ SET DEF SYS$LOGIN                     $ cd
$ SET DEF [-]                           $ cd ..
$ SET DEF [top.dir.subdir]              $ cd /top/dir/subdir
$ SET DEF [.dir.subdir]                 $ cd dir/subdir
$ SHOW DEF                              $ pwd
\end{verbatim}
\end{tscreen}


¶Ôì¶µµ°¸µÄÊôÐÔ£¨protections, ownership£©£¬»¹ÓÐÒ»Ð©½ø½×Ö÷Ìâ£¬Çë²ÎÕÕ \ref{Advanced Topics} {(½ø½×)}.




\subsection{³ÌÊ½}



\begin{itemize}
\item  Ö¸Áî£¬±àÒë¹ýµÄ³ÌÊ½£¨Ö´ÐÐµµ£©£¬ºÍ shell scripts (VMS ÉÏµÄ `command files') ²¢Ã»ÓÐÇ¿ÖÆ¹æ¶¨ÐèÒªÓÐÌØ¶¨µÄ¸±µµÃû¡£
Ïñ {\ttfamily .EXE} or {\ttfamily .COM} µÈ£¬Ö»ÒªÄúÏ²»¶£¬ÄúÏëÒªËý½ÐÊ²÷áÃû×Ö¶¼¿ÉÒÔ¡£
Èç¹ûÄúÊ¹ÓÃ {\ttfamily ls -F} À´²ì¿´Ö´ÐÐµµµÄÊ±ºò£¬Äú»á·¢ÏÖÖ´ÐÐµµ»á±»±êÊ¾³É '{\ttfamily *}' ¡£
\item  ÓûÖ´ÐÐ¿ÉÖ´ÐÐµÄ³ÌÊ½£¬Ö»ÒªÊäÈëÖ¸ÁîÃû³Æ¾Í¿ÉÒÔÁË¡££¨Ã»ÓÐËùÎ½µÄ {\ttfamily RUN PROGRAM.EXE} »òÊÇ {\ttfamily @COMMAND})¡£ 
×¢Òâ£ºÕâ¸öÖ´ÐÐµµ±ØÐëÖ¸¶¨Ä³Â·¾¶¡£»ù±¾ÉÏ£¬Ô¤ÉèÂ¼¾­°üº¬ÁË {\ttfamily /bin},
{\ttfamily /usr/bin}, {\ttfamily /usr/X11R6/bin}, µÈµÈ¡£ Èç¹û£¬Äú×Ô¼ºÐ´ÁËÒ»¸ö³ÌÊ½£¬
Äú¿ÉÒÔ½«Õâ¸ö³ÌÊ½·ÅÔÚÄú×Ô¼ºµÄÔ¤ÉèÂ·¾¶ÖÐ£¨ÈçºÎ²Ù×÷£¬Çë²ÎÕÕ \ref{Configuring} {(Éè¶¨)}£©¡£
»òÊÇÄúÒ²¿ÉÒÔÖ¸¶¨Ò»¸ö¾ø¶ÔÂ·¾¶À´Ö´ÐÐÕâÖ»³ÌÊ½£¬ÀýÈç£º{\ttfamily /home/guido/data/myprog}; »òÊÇ
Ê¹ÓÃÏà¶ÔÂ·¾¶ {\ttfamily ./myprog} ¡£
\item  Ö¸ÁîµÄ²ÎÊýÔÚ VMS ÉÏÊÇÊ¹ÓÃ {\ttfamily /OPTION=} À´Íê³É£¬¶øÔÚ Linux ÉÏ£¬
ÎÒÃÇÊ¹ÓÃ {\ttfamily -switch} »òÊÇ {\ttfamily --switch} £¨{\ttfamily switch} ²ÎÊý¿ÉÄÜÊÇÒ»¸ö×ÖÔª£¬Ðí¶à×ÖµÄ×éºÏ£¬»òÊÇÒ»¸ö×Ö£©¡£
±È½ÏÌØ±ðµÄ£¬²ÎÊý {\ttfamily -R} (recursive) ÔÚ Linux ÉÏºÍ ÔÚ VMS ÉÏ {\ttfamily [...]} °çÑÝÖøÏàÍ¬µÄ¹¦ÄÜ;
\item  ÔÚÃüÁîÁÐÖÐ£¬Äú¿ÉÒÔÒ»´ÎÏÂºÜ¶à¸öÖ¸Áî£º

\begin{tscreen}
\begin{verbatim}
$ command1 ; command2 ; ... ; commandn
\end{verbatim}
\end{tscreen}

\item  Linux ´ó²¿·ÖµÄµ¯ÐÔÀ´×Ôì¶Á½¸öÌØÐÔ£¬¶øÕâÁ½¸öÌØÐÔÔÚ VMS ÉÏÈ´ºÜÄÑ±»±íÊ¾³öÀ´£¬»òÊÇ¸ù±¾¾ÍÃ»ÓÐ¡£
ËýÃÇ·Ö±ðÊÇ£ºI/O ÖØµ¼(redirection) ºÍ ¹ÜµÀ (piping)¡£ £¨Ôø¾­ÓÐÈË¸æËßÎÒ×î½üµÄ DCL °æ±¾ÓÐÖ§Ô®ÖØµ¼(redirection)ºÍ¹ÜµÀ(piping)£¬
¿ÉÊÇÎÒÃ»ÓÐÄÇ¸ö°æ±¾£©¡£ÖØµ¼(redirection) ÔÚ VMS ÉÏÖ»ÊÇ´ÓÊôµÄÌØáç£¨ÏñÖ¸ÁîÀïµÄ²ÎÊý {\ttfamily /OUTPUT=} £©£¬ 
»òÊÇÒ»¸öÄÑÌÖºÃµÄÐÐ³Ì(process)¡£
ÀýÈç£º

\begin{tscreen}
\begin{verbatim}
$ DEFINE /USER SYS$OUTPUT OUT 
$ DEFINE /USER SYS$INPUT IN
$ RUN PROG
\end{verbatim}
\end{tscreen}


ÔÚ Linux ¾ÍÖ»ÒªÕâÑù¾Í¿ÉÒÔ´ï³É£º

\begin{tscreen}
\begin{verbatim}
$ prog < in > out
\end{verbatim}
\end{tscreen}


Piping Êµ¼ÊÉÏÔÚ VMS ÉÏ²¢Ã»ÓÐÌá¹©£¬µ«ÊÇÔÚ Linux È´ÊÇÒ»¸öÖØÒªµÄ½ÇÉ«¡£
µäÐÍµÄÀý×ÓÈçÏÂ£º

\begin{tscreen}
\begin{verbatim}
$ myprog < datafile | filter_1 | filter_2 >> result.dat 2> errors.log &
\end{verbatim}
\end{tscreen}


ÒâË¼ÊÇËµ£º³ÌÊ½ {\ttfamily myprog} µ¼ÈëÒ»¸öµµ°¸Îª input £¨ÓÉ ¡°{\ttfamily $<$}¡±¶ÁÈëµµ°¸ {\ttfamily datafile}£©¡£
ÆäÖ´ÐÐááµÄ½á¹û±»×ªÎª(pipe)ÁíÒ»¸ö³ÌÊ½(filter\_1) µÄ input£¬´¦ÀíááµÃµ½µÄ½á¹ûÔÙ×ªÎªÁíÍâÒ»Ö»³ÌÊ½(filter\_2)µÄ input£¬
ÔÙ×÷½øÒ»²½µÄ´¦Àíáá£¬×îááµÄ½á¹û±»¸½¼Óµ½ result.dat µµ°¸ÉÏ£¬½«´íÎóÑ¶Ï¢¸²¸Çµ½ errors.log µÄµµ°¸ÉÏ¡£
¶øÕâÒ»ÇÐµÄ¶¯×÷£¬¶¼ÔÚ±³¾°Ö´ÐÐ¡£
ÏëÒª¿´¸ü¾«²ÊµÄÀý×Ó£¬Çë²ÎÕÕ \ref{Examples} {(ÊµÀý)}.
\end{itemize}
 

¶Ôì¶¶à¹¤£¬`queues', »òÆäËûÀàËÆÖ÷Ìâ£¬Çë²ÎÔÄ \ref{Advanced Topics} {(½ø½×)}.




\subsection{¿ìËÙä¯ÀÀ \label{Quick Tour}}



ÏÖÔÚÄú¿ÉÒÔÀ´ÊÔÊÔ Linux µÄÍþÁ¦ÁË¡£ÊäÈëÄúµÄ login name ºÍ password¡£¼ÙÉèÄúµÄ login name ÊÇ
{\ttfamily john} £¬Password ÊÇ {\ttfamily My\_PassWd}, {\itshape ²»Òª\/} ÊäÈë {\ttfamily John} »òÊÇ {\ttfamily my\_passwd}¡£
¼Ç×¡£¬´óÐ¡Ð´¶Ô Unix À´Ëµ£¬ÊÇ²»Í¬µÄÒâË¼¡£

Ò»µ±ÄúµÇÈëáá£¬Äú¾Í»á¿´µ½ÏµÍ³ÌáÊ¾·ûºÅ(prompt)£»¿ÉÄÜ¿´ÆðÀ´Ïñ {\ttfamily machinename:\$}¡£ 
Èç¹ûÄúÏë¸ü¸ÄÄúµÄÏµÍ³ÌáÊ¾·ûºÅ£¬»òÊÇÔÚÄúÒ» Login áá¾Í×Ô¶¯Ö´ÐÐÒ»Ð©³ÌÊ½£¬Äú¿ÉÄÜÐèÒªÈ¥±à¼­Ò»¸öÒþ²Øµµ£¨{\ttfamily .profile} »òÊÇ {\ttfamily .bash\_profile}£©¡£
£¨ÊµÀýÇë²ÎÕÕ¡°×éÌ¬Éè¶¨¡±Ò»ÕÂ½Ú \ref{Configuring} {(Éè¶¨)}£©¡£
ÕâºÍ VMS ÉÏµÄ{\ttfamily LOGIN.COM} ÓÐÒìÇúÍ¬¹¤Ö®Ãî¡£

Äú¿ÉÒÔÊ¹ÓÃ ALT--F1, ALT--F2, ... ALT--F6 À´ÇÐ»»Áù¸ö `virtual consoles'¡£
µ±ÄúÆäÖÐµÄÒ»¸ö virtual consoles ÕýÔÚÃ¦ì¶´¦ÀíÄ³Ò»Ö»³ÌÊ½µÄÊ±ºò£¬Äú¿ÉÒÔÈÎÒâµÄÇÐ»»µ½ÈÎºÎÒ»¸ö virtual consoles ¼ÌÐøÄúÆäËûµÄ¹¤×÷¡£
ÊÔÖøÇÐ»»µÇÈëµ½ÆäËûµÄ virtual consoles °É£¡

ÏÖÔÚÄú¿ÉÄÜÏëÒª¿ªÊ¼Ö´ÐÐ X Windows ÁË°É£¨ÒÔááÎÒÃÇ¼ò³ÆÎª X£©¡£X ÊÇÍ¼ÐÎ½çÃæ»·¾³£¬
ÓÐµãÏñ DECWindows --- Êµ¼ÊÉÏ£¬DECWindows ÊÇÑÜÉú×Ô X Window system.
ÇëÊäÈë {\ttfamily startx} ²¢ÇÒµÈ´ý¼¸ÃëÄú½«»á¿´µ½ {\ttfamily xterm} »òÊÇÆäËûÀàËÆµÄÖÕ¶Ë»úÄ£Äâ³ÌÊ½±»¿ªÆô£¬
¿ÉÄÜ»¹»áÓÐÒ»¸ö¹¤×÷ÁÐ¡££¨ÊÓÄúÏµÍ³¹ÜÀíÔ±ÈçºÎÉè¶¨£¬²»Ò»ÑùµÄÉè¶¨£¬Ëù¿´µ½µÄ½á¹û½«»á²»Í¬£©¡£
ÊÔÖøÔÚ×ÀÃæÉÏÍ¬Ê±°´ÏÂ»¬ÊóµÄ×óÓÒ¼ü£¬Äú¿ÉÒÔ¿´µ½Ò»¸öµ¯ÌøÊÓÑ¡µ¥³öÏÖ£¨»¬Êó°´¼üµÄ¹¦ÄÜÒ²ÒòÉè¶¨²»Í¬¶øÓÐ²»Í¬µÄ¹¦ÄÜ£©¡£

½øÈë X áá£¬Èç¹ûÏëÒªÖ´ÐÐÎÄ×ÖÄ£Ê½µÄÖÕ¶Ë»ú (`console') Í¬Ê±°´×¡ÏÂÁÐÈÎÒ»×é°´¼ü£º
CTRL--ALT--F1 ... CTRL--ALT--F6 £¨ÐèÒªÍ¬Ê±°´£©¡£ÊÇ¿´¿´£¡Èç¹ûÏëÒªÌø»ØÊÓ´°½çÃæ£¬¿ÉÒÔ
Í¬Ê±°´ÏÂ ALT--F7 ¾Í¿ÉÒÔÁË¡£Óû½áÊø X £¬ÕâÖøÑ¡µ¥ÉÏµÄ exit Ñ¡Ïî½áÊø£¬»òÊÇÍ¬Ê±°´ÏÂ
CTRL--ALT--BS.

ÊäÈëÏÂÁÐÖ¸Áî£¬¿ÉÒÔÁÐ³öÄúÏÖÔÚÄ¿Â¼ÏÂµÄµµ°¸£¨°üÀ¨Òþ²Øµµ£©£º

\begin{tscreen}
\begin{verbatim}
$ ls -al
\end{verbatim}
\end{tscreen}


°´ SHIFT--PAG UP ¿ÉÒÔÍù»Ø¾íµ½ÒÔÇ°µÄÓ©Ä»¡£

ÏÖÔÚÎÒÃÇÀ´¿´¿´Ö¸Áî {\ttfamily ls} µÄËµÃ÷µµ(help)£¬
ÊäÈë£º

\begin{tscreen}
\begin{verbatim}
$ man ls
\end{verbatim}
\end{tscreen}


°´ÏÂ 'q' ¿ÉÒÔÌø³ö¡£Èç¹ûÒªµÇ³ö£¬¿ÉÒÔÊäÈë {\ttfamily exit} µÇ³öÄ¿Ç°ÖÕ¶Ë»ú¡£
Èç¹ûÏëÒª¹Ø»ú£¬¿ÉÒÔÍ¬Ê±°´ÏÂ CTRL--ALT--DEL ²¢ÇÒµÈ´øÊýÃë¾Í¿ÉÒÔÁË¡£
({\itshape ×¢Òâ£º\/} ¾ø¶Ô²»ÒªÖ±½Ó¾Í¹ØµôÄúµçÄÔÉÏµÄµçÔ´£¬Çë°´ÕÕÒ»¶¨µÄ¹Ø»ú³ÌÐò²Å¿ÉÒÔ¹ØµôµçÔ´£¬²»È»¿ÉÄÜ»áÉËº¦µ½µµ°¸ÏµÍ³£©¡£

Èç¹ûÄúÏëÄúÒÑ¾­¿ÉÒÔÉÏÂ·ÁË£¬ÄÇ¾Í·ÅÊÖÈ¥×÷°É£¡µ«ÊÇ£¬Èç¹ûÎÒÊÇÄúµÄ»°£¬¿É»áÏÈÌøµ½½ø½×Ö÷ÌâÕâÒ»ÕÂ½Ú£º
\ref{Advanced Topics} {(½ø½×)}.






\section{µµ°¸±à¼­ \label{Editing Files}}



Linux Ã»ÓÐ {\ttfamily EDT} ±à¼­Æ÷£¬µ«ÊÇÓÐºÜ¶àµÄ±à¼­Æ÷Ñ¡Ôñ¿É¹©Ê¹ÓÃ¡£
ÔÚËùÓÐUNIX ÏµÍ³ÖÐ£¬Î¨Ò»±£Ö¤Ò»¶¨ÓÐ{\ttfamily vi} Õâ¸ö±à¼­Æ÷---ËãÁË°É£¬
ÄúµÄÏµÍ³¹ÜÀíÔ±Ò»¶¨ÒÑ¾­°²×°±È vi ¸üºÃÓÃµÄ±à¼­Æ÷ÁË¡£¿ÉÄÜ±È½ÏÊÜ»¶Ó­µÄ±à¼­Æ÷ÊÇ
{\ttfamily emacs}£¬Õâ¿ÉÒÔÓÃÀ´Ä£Äâ VMS ÉÏµÄ {\ttfamily EDT} ; {\ttfamily jed} 
ÊÇÁíÒ»ÖÖÀàËÆ {\ttfamily EDT} µÄ±à¼­Æ÷¡£

ÕâÁ½ÖÖ±à¼­Æ÷ÓÃÀ´±àÐ´³ÌÊ½ÂëÏàµ±µÄÊµÓÃ£¬ÒòÎªËýÃÇÓÐÁ½¸ö {\ttfamily EDT} Ã»ÓÐµÄ¹¦ÄÜ£º
¸ßÁÁ¶ÈÏà¹Ø×Ö£¨syntax hilighting£©ºÍ×Ô¶¯ËõÅÅ£¨automatic indentation£©¡£ 
¶øÇÒ£¬Äú¿ÉÒÔ²»ÐèÒªÌø³ö±à¼­Æ÷£¬¾Í¿ÉÒÔÖ±½ÓÔÚ±à¼­Æ÷Àï±àÒë£¨Compile£©ÄúµÄ³ÌÊ½¡£
(command {\ttfamily ESC-X compile}); Èç¹ûÓÐÓï·¨´íÎó£¬ÓÎ±ê½«»á×Ô¶¯Ìøµ½ÓÐ´íÎóµÄµØ·½¡£
ÎÒ¸Ò´ò¶ÄÄú½«²»»áÏëÔÙ¿´µ½ÄÇÖ»ÓÐÀ¶É«µÄ {\ttfamily EDT} ÁË¡£

Èç¹ûÄúÓÐ {\ttfamily emacs}: Æô¶¯Ëý£¬È»ááÊäÈë {\ttfamily ESC-X edt-emulation-on}¡£
¼üÈë ALT--X or ESC-X ¿ÉÒÔÌø³ö {\ttfamily emacs}£¬Ïñ {\ttfamily EDT} µÄ CTRL--Z¡£
´ÓÏÖÔÚ¿ªÊ¼£¬{\ttfamily emacs} ¾ÍÏñ {\ttfamily EDT} Ò»Ñù£¬³ýÁËÒ»Ð©Ö¸Áî²»Ì«Ò»Ñù¡£
²»Í¬´¦£º

\begin{itemize}
\item  {\itshape ²»ÐÐ\/} Ê¹ÓÃ CTRL--Z À´Ö´ÐÐÃüÁîÁÐÖ¸Áî¡£ (Èç¹ûÄú×öÁË£¬ÄúµÄ emacs ½«»áÍ£Ö¹¹¤×÷£¬
²»¹ýÄú¿ÉÒÔÊÔÖøÊäÈë {\ttfamily fg} À´¼ÌÐøÄúµÄ emacs);
\item  Emacs ÓÐ´óÁ¿µÄÏßÉÏËµÃ÷£¨on-line help£©¡£°´ CTRL-H ?, »òÊÇ CTRL-H T Æô¶¯¡£;
\item  ´æµµ£º CTRL-X CTRL-S;
\item  Àë¿ª£º CTRL-X CTRL-C;
\item  ÐÂÔöÒ»¸öµµ°¸£º CTRL-X CTRL-F, È»áá CTRL-X B ¿ÉÒÔÔÚ¸öµµ°¸ÖÐ×÷ÇÐ»»¡£
\end{itemize}


Èç¹ûÄúÓÐ {\ttfamily jed}£º ¿ÉÒÔÇëÄúµÄÏµÍ³¹ÜÀíÔ±Ç¡µ±µØÉè¶¨ {\ttfamily jed} ¡£
µ±ÄúÆô¶¯Ëýáá£¬Ä£ÄâÆ÷¾ÍÒÑ¾­×Ô¶¯ÔØÈë¡£¿ÉÒÔÊ¹ÓÃ CTRL--H CTRL--H or CTRL-? 
Æô¶¯ÏßÉÏËµÃ÷¡£Ö¸Áî²¿·Ý£¬´óÖÂÉÏºÍ {\ttfamily emacs} ÏàÍ¬¡£ ´ËÍâ£¬
»¹ÓÐÒ»Ð©Ò×ì¶²Ù×÷µÄ²Ù×÷¼üÃ»ÓÐ±»×°¶©ÔÚÔ­À´µÄ {\ttfamily EDT} ÖÐ; 
ÕâÐ©²Ù×÷¼ü¿ÉÒÔÒÀÄúµÄ¸öÈËÏ²ºÃ×ÔÐÐÉè¶¨£¬ÇëÑ¯ÎÊÄúµÄÏµÍ³¹ÜÀíÔ±¡£

»òÐíÄú¿ÉÄÜ»áÊ¹ÓÃÁíÒ»¸öÍêÈ«²»Ò»Ñù²Ù×÷½çÃæµÄ±à¼­Æ÷¡£µ«ÊÇ {\ttfamily emacs} Ö±¾õÉÏ»áÊÇÒ»¸ö²»´íµÄÑ¡Ôñ¡£
ÁíÒ»¸öÊ®·ÖÊÜ»¶Ó­µÄ±à¼­Æ÷ÊÇ£º{\ttfamily joe}, Ëý¿ÉÒÔÄ£ÄâÆäËû±à¼­Æ÷£¬Ïñ {\ttfamily emacs} ¡£
(ÉõÖÁ¸üÈÝÒ×ÉÏÊÖ) »òÊÇ Dos µÄ±à¼­Æ÷¡£ Æô¶¯Õâ¸ö±à¼­Æ÷¾ÍÏñ {\ttfamily jmacs} »òÊÇ {\ttfamily jstar} Ò»Ñù£¬
¿ÉÒÔÊ¹ÓÃ CTRL-X H »òÊÇ CTRL-J µÃµ½·á¸»µÄÏßÉÏËµÃ÷¡£
{\ttfamily emacs} ºÍ {\ttfamily jed} ±È {\ttfamily EDT} ¸ü¾ßÓÐÍþÁ¦¡£






\section{TeXing \label{TeXing}}



TeX ºÍ LaTeX ÔÚ Linux ÉÏÍêÈ«ºÍ VMS Ò»Ñù---²»Í¬µÄµØ·½ÊÇ£¬LinuxµÄÖ´ÐÐËÙ¶È¸ü¿ì :-),
Õâ¸ö¹¤¾ßÓÃÀ´´¦Àí {\ttfamily .dvi} ºÍ {\ttfamily .ps} µÄµµ°¸¸ü¾ãÓÅÊÆ£º

\begin{itemize}
\item  ÓÉ TeX Ö´ÐÐ TeX µµ£¬¾ÍÏñÆ½³£Ò»Ñù£º {\ttfamily tex file.tex};
\item  ×ª»» {\ttfamily .dvi} µ²µ½ {\ttfamily .ps} µµ£¬ÊäÈë
{\ttfamily dvips -o filename.ps filename.dvi};
\item  ¼ìÊÓ {\ttfamily .dvi} µµ£¬ÔÚ X Window ÏÂÊäÈë£º
{\ttfamily xdvi filename.dvi \&}. ÔÚÏÔÊ¾Ò³°´ÏÂ»¬Êó¿ÉÒÔ·Å´ó¡£
ÕâÊÇÒ»¸öÖÇ»ÛÐÍµÄ³ÌÊ½£ºÈç¹ûÄú±à¼­ÇÒÖ´ÐÐ TeX ²úÉúÒ»¸ö½ÏÐÂ°æ±¾µÄ {\ttfamily .dvi} 
µµ°¸£¬{\ttfamily xdvi} »á×Ô¶¯¸üÐÂ;
\item  ¼ìÊÓ {\ttfamily .ps} µµ£¬ ÔÚ X Window ÏÂÊäÈë {\ttfamily ghostview
filename.ps \&}. °´»¬Êó¿ÉÒÔËõ·Å¡£ È«²¿µÄµµ°¸»òÊÇ²¿·Ýµµ°¸¿ÉÒÔ±»ÁÐÓ¡³öÀ´¡£
È»¶ø»¹ÓÐÒ»¸ö±È TeX ¸üºÃµÄ³ÌÊ½£º{\ttfamily gv}.
\item  ÁÐÓ¡ {\ttfamily .ps}: Í¨³£Ö¸ÁîÊÇ {\ttfamily lpr mypaper.ps} £¬µ«ÊÇÈç¹û PostScript ÁÐ±í»ú±»ºô½Ð£¨¼ÙÉèÊ¹ÓÃ ps Ö¸Áî£©
Äú½«»áÊÇÖ´ÐÐ£º {\ttfamily lpr -Pps mypaper.ps}¡£¶Ôì¶¸ü¶àÓÐ¹Ø print queues µÄÑ¶Ï¢£¬Çë²ÎÕÕ
\ref{Print Queues} {(ÁÐÓ¡²º)}.
\end{itemize}







\section{³ÌÊ½ \label{Programming}}



ÔÚ Linux ÉÏÐ´³ÌÊ½¸üÊÇÊæ·þ£ºÓÐÐí¶àºÃÓÃµÃ¹¤¾ß¿ÉÒÔÈÃÐ´³ÌÊ½¸ü¼Ó¿ìËÙ¸ü¼Ó¼òµ¥¡£
ÀýÈç£ºÐ´³ÌÊ½ÎÞ·ÇÊÇµ¥µ÷ÉòÃÆµÄ¹¤×÷£º±à¼­--´æµµ--Àë¿ª--±àÒë--ÖØÐÂ±à¼­ Ò»Ö±·´¸²µÄÖ´ÐÐÍ¬ÑùµÄ¶¯×÷¡£
µ«ÊÇ£¬Èç¹ûÊ¹ÓÃÏñ {\ttfamily emacs} »òÊÇ {\ttfamily jed} µÈ¹¤¾ß£¬ÉÏÊöÄÇÐ©¶¯×÷£¬½«Í³Ò»ÕûºÏÔÚ±à¼­Æ÷Àï£¬Ò»´ÎÍê³É¡£




\subsection{Fortran}



´óÌåÉÏ£¬Ã»ÓÐ¶à´óµÄ²î±ð£¬µ«ÊÇÇë×¢Òâ£¬Õâ¸öÃâ·ÑµÄ±àÒëÆ÷¿É²»ÊÇ°Ù·ÖÖ®°ÙµÄºÍ VMS ÏàÈÝµÄ¡£
¿ÉÄÜ»áÓÐÐ©Ææ¹ÖµÄ½á¹û·¢Éú¡££¨Êµ¼ÊÉÏ£¬VMS µÄ Fortran ±àÒëÆ÷²¢²»ÊÇÒ»¸ö¿ÉÒÔ±ê×¼ÑÓÉìµÄ(non-standard)£©¡£
ÏêÏ¸ÇéÐÎÇë¿´ {\ttfamily /usr/doc/g77/DOC} or {\ttfamily /usr/doc/f2c/f2c.ps}
¡£

ÄúµÄÏµÍ³¹ÜÀíÔ±ÒÑ¾­°²×°ÁËÒ»¸ö½Ð×ö {\ttfamily g77} µÄ compiler (²»´íµ«ÊÇ, ÔÚ
0.5.21 °æ, »¹ÊÇÃ»ÓÐÍêÈ«ºÍ DEC µÄ Fortran °Ù·Ö°ÙµØÏàÈÝ) £¬»òÊÇÒ»¸ö°Ñ Fortran ×ª³É C ÓïÑÔµÄ×ª»»Æ÷£¬½Ð×ö {\ttfamily f2c}¡£ 
¼ÓÉÏËýµÄÒ»¸öÇ°¶Ë(front-ends)×°ÖÃ£¬Ä£Äâ¾ÍÏñÊÇÒ»¸ö Fortran ±àÒëÆ÷¡£
ÒÀÎÒµÄ¾­Ñé£¬{\ttfamily yaf77} Ì×¼þÌá¹©×îºÃµÄ½â¾ö·½°¸¡£

ÓûÊ¹ÓÃ {\ttfamily g77} À´ compile ÄúµÄ Fortran ³ÌÊ½, ÏÈÓÃÈÎÒâ±à¼­¼Ç±à¼­³ÌÊ½Âë£¬ÒÔ¸±µµÃû {\ttfamily .f} ´æµµ£¬
È»ááÖ´ÐÐÈçÏÂ£º

\begin{tscreen}
\begin{verbatim}
$ g77 myprog.f
\end{verbatim}
\end{tscreen}


Ëý»á×Ô¶¯°ïÄú²ú³Æ {\ttfamily a.out} µÄÖ´ÐÐµµ¡£(Äú²»ÐèÒª×÷ÈÎºÎ link µÄ¶¯×÷£©
Èç¹ûÏëÒª²úÉú²»Í¬µÄÖ´ÐÐµµµµÃû£¬¿ÉÒÔÏÂ²ÎÊý£º

\begin{tscreen}
\begin{verbatim}
$ g77 -O2 -o myprog myprog.f
\end{verbatim}
\end{tscreen}


Çë×¢Òâ×î¼Ñ»¯£¡ÒªÇóÄúµÄÏµÍ³¹ÜÀíÔ±Ï¸¶Á±àÒëÆ÷µÄËµÃ÷ÎÄ¼þ£¬²¢ÇÒ¸æÖªÄúÊÇ·ñ»¹ÓÐÈÎºÎµÄ´æÔÚÎÊÌâ¡£

±àÒëÖÐ¼äÂë(subroutine)£º

\begin{tscreen}
\begin{verbatim}
$ g77 -c mysub.f
\end{verbatim}
\end{tscreen}


Õâ»á²úÉú {\ttfamily mysub.o} Õâ¸öµµ°¸¡£ È»ááÄúÐèÒª×÷Á¬½á(link)µÄ¶¯×÷¡£

\begin{tscreen}
\begin{verbatim}
$ g77 -o myprog myprog.f mysub.o
\end{verbatim}
\end{tscreen}


Èç¹ûÄúÏë×÷³Éº¯Êý¿â(library)£¬Äú¿ÉÒÔÕâÑù×÷£º

\begin{tscreen}
\begin{verbatim}
$ cd subroutines/
$ cat *f >mylib.f ; g77 -c mylib.f
\end{verbatim}
\end{tscreen}


Õâ»á²úÉú³ö {\ttfamily mylib.o} £¬Äú¿ÉÒÔÊ¹ÓÃËýÀ´Á¬½áÄúµÄ³ÌÊ½¡£

×îáá£¬Èç¹ûÒª link ÆäËûµÄº¯Êý¿â(library)£¬ÎÒÃÇ¼ÙÉè {\ttfamily libdummy.so}:

\begin{tscreen}
\begin{verbatim}
$ g77 -o myprog myprog.f -ldummy
\end{verbatim}
\end{tscreen}


Èç¹ûÄúÊ¹ÓÃ {\ttfamily f2c}, ÄúÖ»ÄÜÊ¹ÓÃ {\ttfamily f77} »òÊÇ {\ttfamily fort77} £¬¶ø²»ÄÜÊ¹ÓÃ {\ttfamily g77}¡£

ÁíÒ»¸öÓÐÓÃµÄ¹¤¾ßÊÇ {\ttfamily make}, ÏêÊöÈçÏÂ£º






\subsection{ÈçºÎÊ¹ÓÃ {\ttfamily make}}



{\ttfamily make} ¿ÉÒÔÓÃÀ´±à¼­ºÜ¶à·ÖÉ¢ì¶¸öµµ°¸µÄÔ­Ê¼Âë¡£ÔÚ VMS ÉÏÎÒÃÇ³ÆÎª {\ttfamily MMS}
ºÍ {\ttfamily MMK}, µ«ÊÇËýÃÇºÍ Linux ÓÐ²»Í¬µÄÓï·¨¡£

¼ÙÉèÄúÓÐÒ»Ð©Ô­Ê¼³ÌÊ½£¬ÐèÒª×÷Ð©ÀýÐÐ³ÌÐò¡£³ÌÊ½·Ö±ðÎª {\ttfamily file\_1.f,
file\_2.f, file\_3.f}, Ö÷³ÌÊ½Îª {\ttfamily myprog.f}¡£ Èç¹ûÄúÊÇÊÖ¶¯±àÒëÄúµÄ³ÌÊ½£¬Ã¿µ±ÄúÐÞ¸ÄÄúµÄ³ÌÊ½Âëáá£¬
Äú±ØÐëÖªµÀÄÄ¸öµµ°¸ºÍÄÄ¸öµµ°¸ÓÐ¹ØÁ¬£¬ÄÄ¸öµµ°¸±ØÐëÏÈ±àÒë£¬µÈµÈ¡£

ÓëÆä·¢·è£¬²»ÈçÄú¿ÉÒÔÐ´¸ö `makefile'¡£ ÕâÊÇÒ»¸öÎÄ×Öµµ£¬ÀïÃæ¼ÇÂ¼ÖøÄú³ÌÊ½ÂëÓë³ÌÊ½ÂëÖ®¼äµÄ¹ØÁ¬ÐÔ¡£
µ±ÆäÖÐÒ»¸öµµ°¸±»ÐÞ¸Äáá£¬Ö»ÓÐÓëÕâ¸ö±»ÐÞ¸ÄµÄµµ°¸ÓÐÏà¹ØµÄµµ°¸ÐèÒª±»ÖØÐÂ±àÒë¡£

ÀýÈç£¬ÄúÐ´ÁËÒ»¸ö makefile ÈçÏÂ£º

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}

# ÕâÊÇÒ»¸ö makefile
# Ê¹ÓÃ <TAB> ¼ü£¬µ±Äú¼ûµ½ <TAB> ±êÇ©Ê±!
# Õâ·Ç³£µÄÖØÒª£¬Çë²»ÒªÊ¹ÓÃ¿Õ°×¼ü´úÌæ¡£

myprog: myprog.o file_1.o file_2.o file_3.o
<TAB>g77 -o myprog myprog.o file_1.o file_2.o file_3.o
# myprog depends on four object files

myprog.o: myprog.f
<TAB>g77 -c myprog.f
# myprog.o depends on its source file

file_1.o: file_1.f
<TAB>g77 -c file_1.f
# file_1.o depends on its source file

file_2.o: file_2.f file_1.o
<TAB>g77 -c file_2.f file_1.o
# file_2.o depends on its source file and an object file

file_3.o: file_3.f file_2.o
<TAB>g77 -c file_3.f file_2.o
# file_3.o depends on its source file and an object file

# end of makefile.
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


´¢´æÕâ¸öµµ°¸£¬ÃüÃûÎª {\ttfamily Makefile} ÇÒÔÚÃüÁîÁÐÊäÈë {\ttfamily make} À´±àÒëÄúµÄ³ÌÊ½;
»òÊÇÄúÒ²¿ÉÒÔ½«Ëý´æ³É {\ttfamily myprog.mak} È»ááÊ¹ÓÃ {\ttfamily make -f myprog.mak} À´±àÒë.
½ÓÏÂÀ´µÄááÐø¶¯×÷, RMP.£¨»¹¼ÇµÃÊ²÷áÊÇ RMP °É£¡£©






\subsection{Shell Scripts}



Shell scripts ¾ÍÏñ VMS ÉÏµÄ command files¡£, Õâ¿ÉÒÔ½¨¹¹³ö·Ç³£ÓÐÓÃµÄ¹¦ÄÜ¡£

ÒªÐ´Ò»¸ö script, ÄúËùÒª×÷µÄ¾ÍÖ»ÊÇÐ´Ò»¸ö°üº¬Ò»Ð©Ö¸ÁîµÄÎÄ×Öµµ£¬È»áá´æµµ£¬¸Ä±ä³É¿ÉÖ´ÐÐµÄÄ£Ê½
£¨Ê¹ÓÃ {\ttfamily chmod +x $<$scriptfile{$>$}}£©¡£ Ö»ÒªÊäÈë¸Ã Script µÄÃû×Ö¾Í¿ÉÒÔÖ´ÐÐÁË¡£

Ð´Ò»¸ö Script ÊÇÒ»¸ö·Ç³£ÖØ´óµÄ¹¤³Ì£¬ÕâÐèÒªÒ»±¾Êé¡£ÕâÀïÎÒ¾Í²»ÔÙ¶à×öËµÃ÷ÁË¡£

ÎÒÖ»¸øÄúÒ»¸ö»ò¶à»òÉÙµÄ×ÛºÏµÄ£¨Ï£Íû£©ÓÐÓÃµÄÀý×Ó£¬Äú»òÐí¿ÉÒÔ´ÓÕâ¸öÀý×ÓÖÐµÃµ½Ò»Ð©»ù±¾µÄ¹æÔò¡£

EXAMPLE: sample.sh

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
#!/bin/sh
# sample.sh
# I am a comment
# ²»ÒªÐÞ¸ÄµÚÒ»ÐÐ£¬Ëý±ØÐëÒÔÕâÖÖÐÎÊ½´æÔÚÔÚµÚÒ»ÐÐ£¡£¡£¡
echo "This system is: `uname -a`" # use the output of the command
echo "My name is $0" # built-in variables
echo "You gave me the following $# parameters: "$*
echo "First parameter is: "$1
echo -n "What's your name? " ; read your_name
echo notice the difference: "hi $your_name" # quoting with "
echo notice the difference: 'hi $your_name' # quoting with '
DIRS=0 ; FILES=0
for file in `ls .` ; do
  if [ -d ${file} ] ; then # if file is a directory
    DIRS=`expr $DIRS + 1`  # this means DIRS = DIRS + 1
  elif [ -f ${file} ] ; then
    FILES=`expr $FILES + 1`
  fi
  case ${file} in
    *.gif|*jpg) echo "${file}: graphic file" ;;
    *.txt|*.tex) echo "${file}: text file" ;;
    *.c|*.f|*.for) echo "${file}: source file" ;;
    *) echo "${file}: generic file" ;;
  esac
done
echo "there are ${DIRS} directories and ${FILES} files"
ls | grep "ZxY--!!!WKW"
if [ $? != 0 ] ; then # exit code of last command
  echo "ZxY--!!!WKW not found"
fi
echo "enough... type 'man bash' if you want more info."
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}





\subsection{C ÓïÑÔ\label{C}}



Linux ÊÇÒ»¸öÐ´ £ÃÓïÑÔµÄºÃµØ·½¡£¾Í¼ÙÉèÄú»á£ÃÓïÑÔ°É£¡ÕâÀïÒ²¼¸¸öÖ¸µ¼·½Õë¡£
±àÒëÄúµÄ³ÌÊ½{\ttfamily hello.c} £¬Äú»áÊ¹ÓÃµ½ {\ttfamily gcc} compiler, ÕâÒÑÊÇ Linux µÄÒ»²¿·ÝÁË¡£
¶øÇÒºÍ {\ttfamily g77} ÓÐÏàÍ¬µÄÊ¹ÓÃ·½·¨:

\begin{tscreen}
\begin{verbatim}
$ gcc -O2 -o hello hello.c
\end{verbatim}
\end{tscreen}


Á¬½á(link)º¯Êý¿â(library)£¬¼ÓÈë²ÎÊý {\ttfamily -l$<$libname$>$}¡£
ÀýÈç£¬Òª link ÊýÑ§º¯Êý¿âºÍ×î¼Ñ»¯£¬¿ÉÒÔÏÂÈçÏÂÖ¸Áî£º

\begin{tscreen}
\begin{verbatim}
$ gcc -O2 -o mathprog mathprog.c -lm
\end{verbatim}
\end{tscreen}


( {\ttfamily -l$<$libname$>$} ²ÎÊýÇ¿ÆÈ {\ttfamily gcc} Á¬½á(link)º¯Êý¿â(library)
{\ttfamily /usr/lib/lib$<$libname$>$.a}; ËùÒÔ {\ttfamily -lm} ¾ÍÁ¬½áÁË
{\ttfamily /usr/lib/libm.a}).

Èç¹ûÄúµÄ³ÌÊ½ÊÇÓÉÐí¶àµµ°¸×é³ÉµÄ£¬Äú¿ÉÄÜÒ²ÐèÒªÊ¹ÓÃÇ°ÃæËùÌáµ½µÄ {\ttfamily make} Õâ¸ö¹¤¾ß¡£
ÔÚ makefile Ê¹ÓÃ {\ttfamily gcc} ºÍ £ÃÓïÑÔµÄÔ­Ê¼Âëµµ°¸¾Í¿ÉÒÔÁË¡£

ÄúÒ²¿ÉÒÔ»ñµÃÓÐ¹Ø C ÓïÑÔµÄº¯ÊýµÄËµÃ÷¡£ÕâÐ©ËµÃ÷ÎÄ¼þ¶¼ÒÑ¾­±»±à³É man pages£¬µÚÈý½Ú(section 3) ÁË¡£
ÀýÈç:

\begin{tscreen}
\begin{verbatim}
$ man 3 printf
\end{verbatim}
\end{tscreen}


Í¬Ê±£¬ÓÐÐíÐí¶à¶àµÄº¯Êý¿â¿É¹©Ê¹ÓÃ¡£ÆäÖÐÄúµÚÒ»ÏëÒªÊ¹ÓÃµÄÊÇ {\ttfamily ncurses}, 
Õâ¿ÉÒÔÓÃÀ´´¦ÀíÎÄ×ÖÄ£Ê½ÏÂµÄÌØÐ§¡£»òÊÇ {\ttfamily svgalib}, Õâ¿ÉÒÔÓÃÀ´´¦ÀíÍ¼ÐÎÄ£Ê½¡£




\section{Í¼ÐÎ½çÃæ \label{Graphics}}



ÔÚÐí¶àÍ¼ÐÎÌ×¼þÖÐ£¬{\ttfamily gnuplot} ÕæÊÇÆäÖÐÖ®ÇÌ³þ¡£½øÈë X Window ááÊäÈë {\ttfamily gnuplot}, 
¿ÉÊÇÖø¶ÁÈëÁ½¸ö¡õÀýµµ: {\ttfamily 2D-data.dat} (Ã¿ÐÐÓÐÁ½±Ê×ÊÁÏ), ºÍ 
{\ttfamily 3D-data.dat} (Ã¿ÐÐÓÐÈý±Ê×ÊÁÏ).

Àý£º2-D graphs:

\begin{tscreen}
\begin{verbatim}
gnuplot> set title "my first graph"
gnuplot> plot '2D-data.dat'
gnuplot> plot '2D-data.dat' with linespoints
gnuplot> plot '2D-data.dat', sin(x)
gnuplot> plot [-5:10] '2D-data.dat'
\end{verbatim}
\end{tscreen}


Àý£º3-D graphs (Ã¿Ò»ÐÐÖÐµÄ×ÊÁÏÒÔ¿Õ°×¼ü×îÎª·Ö¸ô):

\begin{tscreen}
\begin{verbatim}
gnuplot> set parametric ; set hidden3d ; set contour
gnuplot> splot '3D-data.dat' using 1:2:3 with linespoints
\end{verbatim}
\end{tscreen}


Ö»ÓÐÒ»ÐÐ×ÊÁÏµÄµµ°¸(ÈçÊ±¼äÐòÁÐ)Ò²¿ÉÒÔ±»»æÖÆ³É 2-D µÄÍ¼ÐÎ£º

\begin{tscreen}
\begin{verbatim}
gnuplot> plot [-5:15] '2D-data-1col.dat' with linespoints
\end{verbatim}
\end{tscreen}


»òÊÇ»æ³É 3-D graph :

\begin{tscreen}
\begin{verbatim}
gnuplot> set noparametric ; set hidden3d
gnuplot> splot '3D-data-1col.dat' using 1 with linespoints
\end{verbatim}
\end{tscreen}


ÁÐÓ¡Í¼ÐÎ£º¼ÙÉèÄúµÄ Postscript ÁÐ±í»úµÄÖ¸ÁîÊÇ
{\ttfamily lpr -Pps file.ps}£¬²½ÖèÈçÏÂ:

\begin{tscreen}
\begin{verbatim}
gnuplot> set term post
gnuplot> set out '| lpr -Pps'
gnuplot> replot
\end{verbatim}
\end{tscreen}


È»ááÊäÈë {\ttfamily set term x11} »Ø¸´³É x11 Ä£Ê½¡£
±ð»³ÒÉ£¬µ±ÄúÀë¿ª {\ttfamily gnuplot} áá£¬ÎÄ¼þ½«»á×Ô¶¯ÁÐÓ¡³öÀ´¡£

¸ü¶àÑ¶Ï¢£¬¿ÉÊäÈë {\ttfamily help} »òÊÇ²Î¼ûÄ¿Â¼ÖÐµÄ¡õÀý¡£
£¨{\ttfamily /usr/lib/gnuplot/demos/}£©






\section{Mail ºÍ Internet ¹¤¾ß \label{Mail and Internet Tools}}



ÒòÎªÍøÂ·ÊÇµ®ÉúÔÚ Unix µÄ»úÆ÷ÉÏ£¬Äú¿ÉÒÔÔÚ Linux ÉÏ·¢ÏÖÐí¶àºÃÓÃÇÒÒ×ÉÏÊÖµÄÈíÌå¡£
ÕßÀïËùÁÐ£¬Ö»ÊÇÆäÖÐµÄÒ»²¿·Ý¶øÒÑ£º

\begin{itemize}
\item  {\bfseries Mail}: Ê¹ÓÃ {\ttfamily elm} »òÊÇ {\ttfamily pine} À´´¦ÀíÄúµÄ email; ÕâÁ½¸öÓ¦ÓÃ³ÌÊ½¶¼ÓÐÏßÉÏËµÃ÷(Online Help)¡£
¶Ôì¶½Ï¶ÌµÄÑ¶Ï¢£¬Äú¿ÉÄÜÊ¹ÓÃ {\ttfamily mail}, Èç {\ttfamily mail -s "hello mate" user@somewhere {$<$} msg.txt}. 
Äú¿ÉÄÜ»á°®ÉÏÏñ {\ttfamily xmail} ÕâÑùµÄÓ¦ÓÃ³ÌÊ½£¬»òÊÇÀàËÆµÄ³ÌÊ½¡£
\item  {\bfseries Newsgroups}: ¿ÉÊ¹ÓÃ {\ttfamily tin} »òÊÇ {\ttfamily slrn}, Á½Õß¶¼ÊÇÖ±¾õÊ½£¬ÇÒ×ÔÎÒ½â¶Á(self-explanatory).
\item  {\bfseries ftp}: ÓûÍÑÀëÎÄ×Ö½çÃæµÄ {\ttfamily ftp} Ó¦ÓÃ³ÌÊ½, ÒªÇóÄúµÄÏµÍ³¹ÜÀíÔ±°²×°È«Ó©Ä»(full-screen)Ä£Ê½µÄ ftp ÈíÌå£¬Èç {\ttfamily ncftp} £¬
»òÊÇÍ¼ÐÎ½çÃæµÄ {\ttfamily xftp}.
\item  {\bfseries WWW}: ÆÕ±é´æÔÚµÄ {\ttfamily netscape}, »òÊÇ {\ttfamily xmosaic},
{\ttfamily chimera}, ºÍ {\ttfamily arena} ¶¼ÊÇÍ¼ÐÎ½çÃæµÄä¯ÀÀÆ÷¡£ÁíÍâ»¹ÓÐÒ»¸öÎÄ×Ö½çÃæµÄä¯ÀÀÆ÷ {\ttfamily lynx}, ·Ç³£µÄ¿ìËÙ¶øÇÒÓÖÓÐÐ§ÂÊ¡£
\end{itemize}





\section{½ø½× \label{Advanced Topics}}



µ½Õâ¸ö½×¶Î£¬ÓÎÏ·¾Í±È½Ï¸´ÔÓÁË¡£Ñ§ÍêÕâÐ©¶«Î÷£¬Äú¾Í¿ÉÒÔËµ£¬ÎÒ¶®Ò»Ð© Linux µÄ¶«Î÷ ;-)






\subsection{ÔÊÐíÈ¨(Permissions) ¼° ËùÓÐÈ¨(Ownership) \label{Permissions}}



µµ°¸ºÍÄ¿Â¼¶¼ÓÐÔÊÐíÈ¨(Permission) (¼´ VMS ÉÏµÄ `protections') ºÍËùÓÐÈ¨(ownership), 
Õâ¸ö¹ÛÄî²»ÄÑÀí½â£¬ÒòÎª VMS ÉÏÒ²ÓÐ¡£Èç¹ûÄú²»ÄÜÖ´ÐÐÒ»Ö»³ÌÊ½£¬»òÊÇÄú²»ÄÜÐÞ¸ÄÄ³Ò»µµ°¸£¬
»òÊÇ²»ÄÜ½øÈëÄ³Ä¿Â¼£¬ÕâÊÇÒòÎªÄúÃ»ÓÐ±»¸³ÓèÊ¹ÓÃÕâÐ©×ÊÔ´µÄÈ¨Á¦µÄ¹ØÏµ£¨Ã»ÓÐÔÊÐíÈ¨£©£¬
»òÕßÊÇÕâ¸öµµ°¸µÄ¸ù±¾¾Í²»Êôì¶ÄúµÄ£¨Ã»ÓÐËùÓÐÈ¨£©£¬
ÈÃÎÒÃÇ¿´¿´ÏÂÃæµÄÀý×Ó°É£º

\begin{tscreen}
\begin{verbatim}
$ ls -l /bin/ls
-rwxr-xr-x   1 root     bin         27281 Aug 15  1995 /bin/ls*
\end{verbatim}
\end{tscreen}


µÚÒ»¸öÀ¸Î»ÏÔÊ¾³öÕâ¸öµµ°¸µÄÊ¹ÓÃÈ¨ÏÞ {\ttfamily ls} (ÓµÓÐÕß(owner) ÊÇ root, 
Èº×é(group) ÊÇ bin). ÓµÓÐÈ¨¿ÉÒÔ·Ö³ÉÈýÖÖÄ£Ê½: ÓµÓÐÕß(owner), Èº×é(group), ºÍ ÆäËûÊ¹ÓÃÕß(others)¡£
£¨ºÍ VMS µÄ owner, group, world ÏàËÆ£©£»ÓÐÈýÖÖ²»Í¬µÄÔÊÐíÈ¨(permissions): 
¶Á(read), Ð´(write) (°üº¬ÒÆ³ý(delete)), ºÍÖ´ÐÐ(execute).

´Ó×óµ½ÓÒ£¬{\ttfamily -} ÊÇµµ°¸Ä£Ê½ ({\ttfamily -} = Ò»°ãµµ°¸(ordinary file), {\ttfamily d}
= Ä¿Â¼(directory), {\ttfamily l} = Á¬½á(link), µÈ); {\ttfamily rwx} ÊÇÔÊÐíµµ°¸ÓµÓÐÕß¿ÉÒÔ¶Ô¸Ãµµ°¸×÷¶Á£¬Ð´£¬ºÍÖ´ÐÐµÄ¶¯×÷£»
{\ttfamily r-x} ÊÇÔÊÐíÈº×éÊ¹ÓÃÕß¿ÉÒÔ¶Ô¸Ãµµ°¸×÷¶ÁºÍÖ´ÐÐµÄ¶¯×÷£¬µ«ÊÇ²»¿ÉÒÔ×÷Ð´µÄ¶¯×÷¡££»
{\ttfamily r-x} ÊÇÏÞÖÆÆäËûµÄÊ¹ÓÃÕß¶Ô¸Ãµµ°¸Ö»ÓÐ¶ÁºÍÖ´ÐÐµÄÈ¨ÏÞ£¬È´Ã»ÓÐÐ´µÄÈ¨ÏÞ¡£

ÈçºÎ¸Ä±äµµ°¸µÄÊ¹ÓÃÈ¨ÏÞ£º

\begin{tscreen}
\begin{verbatim}
$ chmod <whoXperm> <file>
\end{verbatim}
\end{tscreen}


ÆäÖÐ who ÊÇ {\ttfamily u} (user£¨Ê¹ÓÃÕß£©, ¼´µµ°¸µÄÓµÓÐÕß), {\ttfamily g} (Èº×é group), {\ttfamily o} (ÆäËû other), 
X ±íÊ¾¿ÉÒÔÎª {\ttfamily +} »ò {\ttfamily -}, perm ¿ÉÒÔÎª {\ttfamily r} (¶Á read), {\ttfamily w} (Ð´ write), »òÊÇ 
{\ttfamily x} (¿ÉÖ´ÐÐ execute). 
¾ÙÀýËµÃ÷£º

\begin{tscreen}
\begin{verbatim}
$ chmod u+x file
\end{verbatim}
\end{tscreen}


ÕâÊÇÕë¶Ô¸Ãµµ°¸£¬¿ª·Å¿ÉÖ´ÐÐµÄÈ¨ÏÞ¸ø¸Ãµµ°¸µÄÓµÓÐÕß¡£¿ÉËõÐ´³É£º
{\ttfamily chmod +x file}.

\begin{tscreen}
\begin{verbatim}
$ chmod go-wx file
\end{verbatim}
\end{tscreen}


ÕâÊÇ¶Ô¸Ãµµ°¸£¬ÒÆ³ýÈº×éÊ¹ÓÃÕßºÍÆäËûÊ¹ÓÃÕß¶Ô¸Ãµµ°¸µÄ¡°Ð´¡±µÄÈ¨ÏÞºÍ¡°Ö´ÐÐ¡±µÄÈ¨ÏÞ¡£

\begin{tscreen}
\begin{verbatim}
$ chmod ugo+rwx file
\end{verbatim}
\end{tscreen}


ÕâÊÇ¿ª·Å¸Ãµµ°¸µÄ¶Á£¬Ð´£¬ºÍÖ´ÐÐµÄÈ¨ÏÞ¸øËùÓÐµÄÊ¹ÓÃÕß¡£

ÁíÒ»¸ö¿ìËÙ±íÊ¾·¨ÎªÊ¹ÓÃÒ»×éÊý×Ö£º{\ttfamily rwxr-xr-x} ¿ÉÒÔÓÃ 755 À´±íÊ¾ (Ã¿Ò»Î»Êý×Ö¶ÔÓ¦Ò»¸ö¿ØÖÆÎ»Ôª: {\ttfamily ---} ±íÊÇ 0, 
{\ttfamily --x} ±íÊ¾ 1, {\ttfamily -w-} ±íÊ¾ 2...).

ËùÒÔ£¬rwx = 4+2+1 = 7£¬r-x = 4+0+1 = 5£¬ËùÒÔ£¬{\ttfamily rwxr-xr-x} ¿ÉÒÔÓÃ 755 À´±íÊ¾¡£

¶ÔÄ¿Â¼¶øÑÔ£¬{\ttfamily rx} ±íÊ¾Äú¿ÉÒÔÇÐ»»µ½¸ÃÄ¿Â¼£º {\ttfamily cd} , ¶ø
{\ttfamily w} ±íÊ¾Äú¿ÉÒÔÉ¾³ý¸ÃÄ¿Â¼µÄµµ°¸(µ±È»ÐèÒªÊÓ¸Ãµµ°¸µÄÊ¹ÓÃÈ¨ÏÞ¶ø¶¨), »òÊÇÄ¿Â¼±¾Éí. 
ÕâÐ©»¹Ö»ÊÇ±ùÉ½µÄÒ»½Ç¶øÒÑ£¬ÏëÒªÖªµÀ¸ü¶à---RMP.

ÈçºÎ¸Ä±äµµ°¸µÄÓµÓÐÈ¨£º

\begin{tscreen}
\begin{verbatim}
$ chown username file
\end{verbatim}
\end{tscreen}


ÎÒÕûÀí³ÉÏÂ±í£º

\begin{tscreen}
\begin{verbatim}
VMS                             Linux                   Notes
------------------------------------------------------------------------------

SET PROT=(O:RW) file.txt        $ chmod u+rw file.txt
                                $ chmod 600 file.txt
SET PROT=(O:RWED,W) file        $ chmod u+rwx file
                                $ chmod 700 file
SET PROT=(O:RWED,W:RE) file     $ chmod 755 file
SET PROT=(O:RW,G:RW,W) file     $ chmod 660 file
SET FILE/OWNER_UIC=JOE file     $ chown joe file
SET DIR/OWNER_UIC=JOE [.dir]    $ chown joe dir/
\end{verbatim}
\end{tscreen}







\subsection{¶à¹¤(Multitasking): ³ÌÐò(Processes) ºÍ ¹¤×÷(Jobs) \label{Multitasking}}



ÓûÖ´ÐÐºÜ¶à³ÌÊ½£¬ÔÚ Linux ÉÏÃ»ÓÐËùÎ½µÄ `batch queues' ; ¶à¹¤ÆäÊµÒÔ·Ç³£²»Ò»ÑùµÄÊÖ·¨´¦Àí¡£
ÒÔÏÂÊÇÒ»°ã³£¼ûµÄÃüÁîÁÐ£º

\begin{tscreen}
\begin{verbatim}
$ command -s1 -s2 ... -sn par1 par2 ... parn < input > output &
\end{verbatim}
\end{tscreen}


ÆäÖÐ {\ttfamily -s1}, ..., {\ttfamily -sn} ÊÇ¸Ã³ÌÊ½µÄ²ÎÊý£¨switch£©, 
{\ttfamily par1}, ..., {\ttfamily parn} ÊÇ³ÌÊ½µÄÊäÈë±äÊý(parameters).

ÏÖÔÚÈÃÎÒÃÇÀ´¿´¿´ÔÚ Linux ÉÏÈçºÎ¶à¹¤¡£³ÌÐò£¨processes£©ÊÇÒ»Ö»²»ÂÛÔÚÇ°¾°»òÊÇ±³¾°±»Ö´ÐÐµÄ³ÌÊ½¡£

\begin{itemize}
\item  ÔÚ±³¾°Ö´ÐÐ³ÌÐò:
\begin{tscreen}
\begin{verbatim}
$ progname [-switches] [parameters] [< input] [> output] &
[1] 234
\end{verbatim}
\end{tscreen}


shell »áÌáÊ¾Äú¸Ã³ÌÐò(process)µÄ¹¤×÷ºÅÂë£¨`job number'£© (µÚÒ»¸öÊý×Ö; Çë¿´ÏÂÎÄ) 
ºÍ¸Ã³ÌÐòµÄ³ÌÐòÊ¶±ðÂë PID (Process IDentifier). Ã¿Ò»¸ö³ÌÐò¶¼ÓÐÒ»×é¶ÀÒ»ÎÞ¶þµÄ PID.
\item  ¼ìÊÓÓÐ¶àÉÙ Processes ±»Ö´ÐÐ£º
\begin{tscreen}
\begin{verbatim}
$ ps -ax
\end{verbatim}
\end{tscreen}

Õâ»áÊä³öÒ»´ó´®ÕýÔÚÖ´ÐÐµÄ³ÌÐò(processes)¡£

\item  É±µô³ÌÐò£º
\begin{tscreen}
\begin{verbatim}
$ kill <PID>
\end{verbatim}
\end{tscreen}

Èç¹ûÄú²»ÖªµÀÒªÈçºÎÕýÈ·µÄÖÕÖ¹Ä³Ò»¸ö³ÌÐò£¬ÕâÊ±Äú¿ÉÄÜ¾ÍÒªÊÖ¶¯°Ñ³ÌÐò¸øÉ±ËÀà¸£¡... ;-). 
ÓÐÐ©Ê±ºò£¬Ò»¸ö³ÌÐòÖ»ÄÜ±»ÏÂÁÐÒ»¸öÖ¸ÁîÉ±ËÀ£º

\begin{tscreen}
\begin{verbatim}
$ kill -15 <PID>
$ kill -9 <PID>
\end{verbatim}
\end{tscreen}

\end{itemize}


¸½´øÒ»Ìá£¬Sell ÔÊÐíÄúÍ£Ö¹»òÊÇÔÝÊ±Í£Ö¹Ò»¸ö³ÌÐò£¬½«³ÌÐòËÍµ½±³¾°¹¤×÷£¬»òÊÇ½«³ÌÐò´Ó±³¾°´øµ½Ç°¾°¡£
ÔÚÕâÀï£¬³ÌÐò(processes)ÎÒÃÇ³ÆÖ®Îª¹¤×÷(`jobs').

\begin{itemize}
\item  ¼ìÊÓÓÐ¶àÉÙ¹¤×÷£¨jobs£©ÕýÔÚÖ´ÐÐ£º
\begin{tscreen}
\begin{verbatim}
$ jobs
\end{verbatim}
\end{tscreen}

¹¤×÷(jobs)ÊÇÓÉ Shell ¸øµÄ¹¤×÷ºÅÂë£¨job number£©À´×÷Çø±ð£¬×¢Òâ£¬²»ÊÇ PID à¸.
\item  ÖÕÖ¹ÔÚÇ°¾°¹¤×÷µÄ³ÌÐò(processes):

\begin{tscreen}
\begin{verbatim}
$ CTRL-C
\end{verbatim}
\end{tscreen}

(²»Ò»¶¨Ã¿Ò»´Î×àÐ§)
\item  ÔÝÍ£ÔÚÇ°¾°¹¤×÷µÄ³ÌÐò(process):
\begin{tscreen}
\begin{verbatim}
$ CTRL-Z
\end{verbatim}
\end{tscreen}

(Í¬ÉÏ)
\item  ½«ÔÝÍ£µÄ³ÌÐò×ª»»³É±³¾°¹¤×÷(background jobs):
\begin{tscreen}
\begin{verbatim}
$ bg <job>
\end{verbatim}
\end{tscreen}

\item  ½«±³¾°¹¤×÷´øµ½Ç°¾°:
\begin{tscreen}
\begin{verbatim}
$ fg <job>
\end{verbatim}
\end{tscreen}

\item  É±µôÒ»¸ö¹¤×÷(job):
\begin{tscreen}
\begin{verbatim}
$ kill <%job>
\end{verbatim}
\end{tscreen}

\end{itemize}





\subsection{ÔÚ·Ãµµ°¸(files)}



¸ü¶àÓÐ¹Øµµ°¸µÄÑ¶Ï¢¡£

\begin{itemize}
\item  {\bfseries stdin, stdout, stderr}: ÔÚ UNIX ÖÐ£¬ÈÎºÎÒ»¸öÏµÍ³Ôª¼þ¶¼±»ÊÓÎªÊÇÒ»¸öµµ°¸¡£
Ö¸Áî»òÊÇÓ¦ÓÃ³ÌÊ½¶ÁÈëÒ»¸öËùÎ½±ê×¼ÊäÈëµÄµµ°¸£¨{\ttfamily stdin}£ºÍ¨³£Îª¼üÅÌ£©£¬
Êä³ö½á¹ûµ½ËùÎ½±ê×¼Êä³öµÄµµ°¸£¨{\ttfamily stdout} £ºÍ¨³ÉÎªÓ©Ä»£©£¬¶ø´íÎóÊä³öÒ²ÊÇÊä³öµ½Ò»¸öµµ°¸£¬
ÎÒÃÇ³ÆÖ®Îª {\ttfamily stderr} (Í¨³£Ò²ÊÇÓ©Ä»).

Ê¹ÓÃ {\ttfamily $<$} ºÍ {\ttfamily $>$} £¬Äú¿ÉÒÔ½«Êä³öºÍÊäÈëÖØÐÂµ¼Ïòµ½ÁíÍâÒ»¸öµµ°¸¡£
È»¶ø£¬ {\ttfamily $>$$>$} ÊÇ½«½á¹û¸½¼Óµ½µµ°¸µÄµµÎ²£¬¶ø²»ÊÇ¸²¸ÇÔ­À´µÄµµ°¸¡£; 
{\ttfamily 2$>$} ÖØµ¼´íÎóÑ¶Ï¢(stderr); 2$>$\&1
ÖØµ¼´íÎóÑ¶Ï¢µ½±ê×¼Êä³ö, ¶ø 1$>$\&2 ÔòÊÇÖØµ¼±ê×¼Êä³öµ½´íÎóÊä³ö¡£
ÓÐÒ»¸öºÚ¶´£¨`black hole'£©½Ð×ö {\ttfamily /dev/null}: ËùÓÐµ¼µ½Õâ¸öµµ°¸µÄ¶«Î÷£¬
¶¼½«ÏûÊ§µÄÎÞÓ°ÎÞ×Ù¡£
\item  {\bfseries wildcards}: ÍòÓÃ×ÖÔª '{\ttfamily *}' ÓÐÏàÍ¬µÄ¹¦ÄÜ¡£ÓÃ·¨: * ·ûºÏËùÓÐµµ°¸£¬³ýÁËÒþ²ØµµÒÔÍâ¡£
.* ·ûºÏËùÓÐÒþ²Øµµ; *.* ·ûºÏÖ»ÓÐÒ»¸öµã '.' ÔÚÖÐ¼äµÄµµ°¸¡£¸úËæÖøÆäËû×ÖÔª£º 
p*r ±íÊ¾ `peter' »òÊÇ `piper' ¶¼ÓÐ¿ÉÄÜ; *c* ¿ÉÄÜ·ûºÏ `picked' »òÊÇ `peck'¡£
'{\ttfamily \%}' »»³É '{\ttfamily ?}'¡£ »¹ÓÐÁíÍâÒ»ÖÖÍòÓÃ×ÖÔª£º{\ttfamily []}. ÓÃ·¨: {\ttfamily [abc]*} ±íÊ¾µµ°¸±ØÐëÒÔ×ÖÔª a, b, c ×îÎª¿ªÍ·; 
{\ttfamily *[I-N,1,2,3]} ±íÊ¾µµ°¸Ãû³ÆÓÉ I, J, K, L, M, N, 1, 2, 3 ×÷Îª½áÎ²¡£
\item  {\ttfamily mv} ({\ttfamily ÖØÐÂÃüÃû}) ²»¿ÉÒÔÒ»´Î¶à¸öµµ°¸¡£¼´ {\ttfamily mv *.xxx *.yyy} ½«²»»áÖ´ÐÐ³É¹¦;
\item  Ê¹ÓÃ {\ttfamily cp -i} ºÍ {\ttfamily mv -i} ¿ÉÒÔÌáÐÑÄúÊÇ·ñÒª¸²¸ÇÒÔ´æÔÚµÄµµ°¸¡£
\end{itemize}







\subsection{ÁÐÓ¡ØùÁÐ \label{Print Queues}}



¾ÍÏñ VMS £¬ÁÐÓ¡¹¤×÷»áÏÈ±»·Åµ½ØùÁÐµ±ÖÐ(queues)£¬µ±ÄúÏÂÁÐÓ¡Ö¸ÁîµÄÊ±ºò£¬Äú»òÐí»áÖ¸¶¨ÁÐ±í»úµÄÃû³Æ¡£
ÀýÈç£º

\begin{tscreen}
\begin{verbatim}
$ lpr file.txt          # Õâ½«Ö¸ÓÃµ½Ô¤ÉèµÄÁÐ±í»ú
$ lpr -Plaser file.ps   # Õâ½«Ê¹ÓÃÃûÎª 'laser' µÄÁÐ±í»ú
\end{verbatim}
\end{tscreen}


´¦ÀíÁÐÓ¡ØùÁÐ(print queues), Äú¿ÉÄÜÐèÒªÏÂÁÐÖ¸Áî£º

\begin{tscreen}
\begin{verbatim}

VMS                                     Linux
------------------------------------------------------------------------------

$ PRINT file.ps                         $ lpr file.ps
$ PRINT/QUEUE=laser file.ps             $ lpr -Plaser file.ps
$ SHOW QUEUE                            $ lpq
$ SHOW QUEUE/QUEUE=laser                $ lpq -Plaser
$ STOP/QUEUE                            $ lprm <item>
\end{verbatim}
\end{tscreen}







\section{Éè¶¨ \label{Configuring}}



ÄúµÄÏµÍ³¹ÜÀíÔ±ÒÑ¾­Ìá¹©ÄúÒ»Ð©×éÌ¬Éè¶¨µµ£¬Èç£º {\ttfamily .xinitrc}, {\ttfamily .bash\_profile}, {\ttfamily .inputrc}, µÈµÈ¡£
ÆäÖÐÄúÏëÒª±à¼­µÄÊÇ£º

\begin{itemize}
\item  {\ttfamily  .bash\_profile} »òÊÇ {\ttfamily .profile}: ÔÚ login Ê±£¬Õâ¸öµµ°¸¾Í±» Shell ¸ø¶Á½øÀ´ÁË¡£¾ÍÏñ VMS ÉÏµÄ {\ttfamily LOGIN.COM};
\item  {\ttfamily  .bash\_logout}: µ±ÒªµÇ³öµÄÊ±ºò£¬¶ÁÈ¡Õâ¸öµµ°¸¡£Õâ¾ÍÏñ VMS ÉÏµÄ {\ttfamily LOGOUT.COM};
\item  {\ttfamily  .bashrc}: ±» non--login shells ¶ÁÈ¡.
\item  {\ttfamily  .inputrc}: Õâ¸öµµ°¸¿ÉÒÔ¶¨×öÒ»×éºÏ¼üºÍÉè¶¨ shell µÄÐÐÎª¡£
\end{itemize}


ÎÒ½«ÒÔÎÒµÄ {\ttfamily .bash\_profile} ×îÎªÊµÀý¡£

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
# $HOME/.bash_profile

# Èç¹û²»ÐèÒª£¬Çë²»ÒªÖØÐÂ¶¨Òå $PATH ±äÊý¡£
echo $PATH | grep $LOGNAME > /dev/null
if [ $? != 0 ]
then
  export PATH="$PATH:/home/$LOGNAME/bin"  # add my dir to the PATH
fi

export PS1='LOGNAME:\w\$ '
export PS2='Continued...>'

# aliases ±ðÃû

alias bin="cd ~/bin" ; alias cp="cp -i" ; alias d="dir"
alias del="delete" ; alias dir="/bin/ls $LS_OPTIONS --format=vertical"
alias ed="jed" ; alias mv='mv -i'
alias u="cd .." ; alias undel="undelete"

# A few useful functions Ò»Ð©ÓÐÓÃµÄº¯Êý£¡¿á£¡

inst() # Install a .tar.gz archive in current directory.
{
  gzip -dc $1 | tar xvf -
}
cz() # List the contents of a .zip archive.
{
  unzip -l $*
}
ctgz() # List the contents of a .tar.gz archive.
{
  for file in $* ; do
    gzip -dc ${file} | tar tf -
  done
}
tgz() # Create a .tgz archive a la zip.
{
  name=$1 ; tar -cvf $1 ; shift
  tar -rf ${name} $* ; gzip -S .tgz ${name}
}
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


ÕâÊÇÎÒµÄ {\ttfamily .inputrc}:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
# $HOME/.inputrc
# ÉÏ´ÎÐÞ¸ÄÈÕÆÚ: 16 January 1997.
#
# ÒÔÏÂÊÇ×¢½â£¬ËµÃ÷Õâ¸ö Script µÄÓÃÒâ¡£
# This file is read by bash and defines key bindings to be used by the shell;
# what follows fixes the keys END, HOME, and DELETE, plus accented letters.
# For more information, man readline.

"\e[1~": beginning-of-line
"\e[3~": delete-char
"\e[4~": end-of-line

set bell-style visible
set meta-flag On
set convert-meta Off
set output-meta On
set horizontal-scroll-mode On
set show-all-if-ambiguous On

# (F1 .. F5) are "\e[[A" ... "\e[[E"

"\e[[A": "info "
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}







\section{ÓÐÓÃµÄ³ÌÊ½ \label{Useful Programs}}






\subsection{ä¯ÀÀµµ°¸: {\ttfamily less}}



Äú½«»áÐèÒªÃ¿ÌìÊ¹ÓÃÕâ¸öµµ°¸ä¯ÀÀÆ÷¡£ËùÒÔÎÒ½«¸øÄúÒ»Ð©¡õóÅÈÃÄúÄÜºÃºÃµÄÀûÓÃÕâ¸ö¹¤¾ß¡£
Ê×ÏÈ£¬ÒªÇóÄúµÄÏµÍ³¹ÜÀíÔ±Õâ¶¨ {\ttfamily less} Ê¹Ëý²»Ö»¿ÉÒÔÏÔÊ¾ÎÄ×Öµµ£¬¸ü¿ÉÒÔÑ¹Ëõµµ°¸ÎÄ¼þ£¬µÈ¡£

¾ÍÏñÏÖÔÚ°æ±¾µÄ {\ttfamily TYPE}, {\ttfamily less} ¿ÉÒÔÈÃÄúä¯ÀÀÄúÄ¿Ç°Ä¿Â¼ÏÂµÄµµ°¸¡£
ËýÍ¬Ê±Ò²¿ÉÒÔ½ÓÊÜÐí¶à¶îÍâÓÉ¼üÅÌÊäÈëµÄ°´¼üÖ¸Áî£¬±È½ÏÓÐÓÃµÄÊÇ£º

\begin{itemize}
\item  µÚÒ», °´ÏÂ {\ttfamily q} ¿ÉÒÔÀë¿ªµµ°¸ä¯ÀÀ;
\item  {\ttfamily h} Ìá¹©ÄúÐí¶àµÄÏßÉÏËµÃ÷;
\item  {\ttfamily g} Ìøµ½µµÍ·, {\ttfamily G} ÒÆÖÁµµÎ², Êý×Ö n ¼Ó {\ttfamily g} ±íÊ¾µ½µÜ n ÐÐ¡£(ÀýÈç {\ttfamily 125g}), 
Êý×Ö¼Ó {\ttfamily \%} ±íÊ¾Ò»µ½¸Ãµµ°¸Ö®°Ù·Ö±È´óÐ¡µÄµØ·½;
\item  {\ttfamily /pattern} ÏòÏÂËÑÑ° `pattern'; {\ttfamily n} ÏòÏÂËÑÑ°ÏÂ±Ê×ÊÁÏ; {\ttfamily ?pattern} ºÍ {\ttfamily N} ±íÊ¾ÏòÉÏÑ°ÕÒ¡£

\item  {\ttfamily m}+letter ±êÊ¾Ä¿Ç°µØ·½ (Èç {\ttfamily ma}); {\ttfamily '}+letter µ½±»±êÊ¾µÄµØ·½.
\item  {\ttfamily :e} ¼ì²éÐÂµµ°¸;
\item  {\ttfamily !command} Ö´ÐÐÃüÁîÁÐµµ°¸.
\end{itemize}







\subsection{ÔÚ Linux ÏÂµÄ°æ±¾±¸·Ý \label{Numbered Backups Under Linux}}





°¦, Linux ²¢Ã»ÓÐÌá¹©µµ°¸°æ±¾µÄ¹¦ÄÜ¡£µ«ÊÇÄú¿ÉÒÔÓÃÁ½ÖÖ·¢·¨½â¾öÕâ¸öÎÊÌâ¡£
µÚÒ»£¬Ê¹ÓÃ RCS, °æ±¾¹ÜÀíÏµÍ³£¨the Revision Control System£©, 
Ëý¿ÉÒÔÈÃÄú¹ÜÀíÏÈÇ°µÄµµ°¸°æ±¾¡£RCS ¿ÉÒÔÔÚ ``The RCS MINI-HOWTO'' (\nameurl{http://sunsite.unc.edu/mdw/HOWTO/mini/RCS.html}{}) ÖÐÕÒµ½.

µÚ¶þÖÖ·½·¨£¬Ê¹ÓÃÖªµÀÈçºÎ´¦Àí°æ±¾±àºÅµÄ±à¼­Æ÷£º{\ttfamily emacs} ºÍ {\ttfamily jed} ¶¼ÓÐÕâ¸ö¹¦ÄÜ¡£
ÔÚ {\ttfamily emacs}, ÔÚ {\ttfamily .emacs} ÄÇ¼ÓÈëÏÂÁÐ¼¸ÐÐ:

\begin{tscreen}
\begin{verbatim}
(setq version-control t)
(setq kept-new-versions 15) ;;; or any other value
(setq kept-old-versions 15)
(setq backup-by-copying-when-linked t)
(setq backup-by-copying-when-mismatch t)
\end{verbatim}
\end{tscreen}


Èç¹ûÊ¹ÓÃ {\ttfamily jed}, ÇëÈ·¶¨ÄúµÄ°æ±¾ÔÚ 0.98.7 ÒÔÉÏ; ËýµÄ¸üÐÂµµ£¬¿ÉÒÔÊ¹ÆäÖ§Ô®Êý×Ö°æ±¾±¸·Ý¡£
Ïà¹ØÎÄ¼þ¿ÉÒÔÔÚ {\ttfamily  \nameurl{http://ibogeo.df.unibo.it/guido/slang/backups.sl}{} } ÖÐÕÒµ½.






\subsection{µµ°¸¹Ý£¨Archiving£©: tar \& gzip}



ÔÚ UNIX Àï£¬ÓÐÒ»Ð©³£ÓÃµ½µÄÓ¦ÓÃ³ÌÊ½À´¼¯ÖÐ¹ÜÀí¼°Ñ¹Ëõµµ°¸¡£
{\ttfamily tar} ¿ÉÒÔÓÃÀ´°ü·âµµ°¸¡£Óû°ü·âµµ°¸¿ÉÓÃÏÂÁÐÖ¸Áî¡£

\begin{tscreen}
\begin{verbatim}
$ tar -cvf <archive_name.tar> <file> [file...]
\end{verbatim}
\end{tscreen}


½â¿ª°ü·âµµ°¸¿ÉÓÃ£º

\begin{tscreen}
\begin{verbatim}
$ tar -xpvf <archive_name.tar> [file...]
\end{verbatim}
\end{tscreen}


ÁÐÊé°ü·âµµ°¸ÖÐËùÓÐµÄµµ°¸£º

\begin{tscreen}
\begin{verbatim}
$ tar -tf <archive_name.tar> | less
\end{verbatim}
\end{tscreen}


¿ÉÒÔÊ¹ÓÃ {\ttfamily compress} »òÊÇ {\ttfamily gzip} À´Ñ¹Ëõµµ°´ÒÔ½ÚÊ¡Ó²µú¿Õ¼ä:

\begin{tscreen}
\begin{verbatim}
$ compress <file>
$ gzip <file>
\end{verbatim}
\end{tscreen}


Èç¹ûÊ¹ÓÃ {\ttfamily compress} À´Ñ¹Ëõµµ°¸£¬ËýÎª°ïÄú²úÉú¸±µµÃûÎª .Z µÄÑ¹Ëõµµ£¬¶ø {\ttfamily gzip} ÔòÊÇÒÔ .gz Îª¸±µµÃû¡£
ÕâÐ©Ó¦ÓÃ³ÌÊ½²¢²»ÄÜÓÃÀ´°ü·âµµ°¸£¬µ«ÊÇ¿ÉÒÔÓÃÀ´Ñ¹Ëõµµ°¸¡£½âÑ¹Ëõ¿ÉÓÃ£º

\begin{tscreen}
\begin{verbatim}
$ compress -d <file.Z>
$ gzip -d <file.gz>
\end{verbatim}
\end{tscreen}


ÏêÏ¸ÇéÐÎ£¬Çë RMP.

´ËÍâ£¬{\ttfamily unarj}, {\ttfamily zip} ºÍ {\ttfamily unzip} Ð©¹¤¾ßÒ²¿ÉÒÔÀûÓÃ¡£
µµ°¸µÄ¸±µµÃûÈç¹ûÊÇ {\ttfamily .tar.gz} »òÊÇ {\ttfamily .tgz} (±íÊ¾ÕâÊÇÒ»¸ö·â×°µµ°¸ {\ttfamily tar}, È»áá£¬
Ê¹ÓÃ {\ttfamily gzip}) Ñ¹ËõÈíÌåÔÙÑ¹Ëõ¶ø³ÉµÄ¡£ÔÚ UNIX µÄÊÀ½ç£¬ÕâÖÖ¸ñÊ½³£³£»á»á¼ûµ½¡£
ÒÔÏÂÊÇÊ¾¡õÈçºÎ²ì¿´ {\ttfamily .tar.gz} µµÄÚµÄÄÚÈÝ¡£

\begin{tscreen}
\begin{verbatim}
$ tar -ztf <file.tar.gz> | less
\end{verbatim}
\end{tscreen}


ÒÔÏÂÊÇÊ¾¡õÈçºÎ½â¿ª {\ttfamily .tar.gz} µµ:

\begin{tscreen}
\begin{verbatim}
$ tar -zxf <file.tar.gz>
\end{verbatim}
\end{tscreen}







\section{Ó¦ÓÃ \label{Examples}}



UNIX µÄÖ÷Òª¿®ÄîÊÇÏ£ÍûÍ¸¹ý¹ÜÏß(piping)ºÍÖØµ¼(redirection)µÄ¹ÛÄî½«ËùÓÐ¼òµ¥µÄÖ¸Áî´®Á¬ÆðÀ´¶ø¿ÉÒÔ×ã¹»Ó¦¸¶ÕæÊµÉú»îÉÏËùÓÐ¸´ÔÓµÄ¹¤×÷¡£
ÈÃÎÒÃÇÀ´¿´¿´ÏÂÃæµÄÀý×Ó£¬ÎÒ½«Ö»½âÊÍ±È½Ï¸´ÔÓµÄÀý×Ó£»ÆäËû¼òµ¥µÄÀý×Ó£¬ÇëÀûÓÃÉÏÃæÎÒËù½éÉÜµÄ¹ÛÄîºÍËµÃ÷ÎÄ¼þ(man pages)£¬ÏàÐÅÄúÒ»¶¨¿ÉÒÔºÜ¿ìµÄ½øÈëÇé¿ö¡£

{\bfseries ÎÊÌâ}: Èç¹ûÖ»Ê¹ÓÃ {\ttfamily ls} Õâ¸öÖ¸ÁîÀ´ÏÔÊ¾µµ°¸£¬Èç¹ûµµ°¸Ì«¶àµÄ»°£¬³£³£¾ÍÒ»·É¶øÊÅ£¬»¹À´²»¼°¿´Íê£¬½á¹û¾Í±»¾íÉÏÈ¥ÁË£º

{\bfseries ½â¾ö·½°¸}:

\begin{tscreen}
\begin{verbatim}
$ ls | less
\end{verbatim}
\end{tscreen}


{\bfseries ÎÊÌâ}: ÎÒÓÐÒ»¸öµµ°¸£¬ÀïÃæ°üº¬ÁËÐí¶àÎÄ×Ö£¬ÎÒÏë½«Ö®·´ÏòÅÅÐòááÁÐÓ¡³öÀ´£º

{\bfseries ½â¾ö·½°¸}:

\begin{tscreen}
\begin{verbatim}
$ cat myfile.txt | sort -r | lpr
\end{verbatim}
\end{tscreen}


{\bfseries ÎÊÌâ}: ÎÒµÄ×ÊÁÏµµÄÚÓÐÐí¶àÖØ¸´µÄ×ÊÁÏ£¬ÎÒÒªÈçºÎÉ¾³ýÖØ¸´µÄ×ÊÁÏÄØ£¿

{\bfseries ½â¾ö·½°¸}:

\begin{tscreen}
\begin{verbatim}
$ sort datafile.dat | uniq > newfile.dat
\end{verbatim}
\end{tscreen}


{\bfseries ÎÊÌâ}: ÎÒÓÐÒ»¸ö½Ð×ö 'mypaper.txt' »òÊÇ 'mypaper.tex' µÄµµ°¸£¬»òÊÇÀàËÆÕâÑùµÄµµ°¸Ãû³Æ£¬µ«ÊÇÎÒÍü¼ÇÎÒ½«ËýÃÇ´æ·ÅÔÚÊ²÷áµØ·½ÁË£¬ÎÒÒªÈçºÎÕÒµ½ËýÃÇÄØ£¿

{\bfseries ½â¾ö·½°¸}:

\begin{tscreen}
\begin{verbatim}
$ find ~ -name "mypaper*" 
\end{verbatim}
\end{tscreen}


ËµÃ÷: {\ttfamily find} ÊÇÒ»¸ö·Ç³£ÓÐÓÃµÄÖ¸Áî£¬Ëý¿ÉÒÔÁÐ³öÊ÷×´Ä¿Â¼ÏÂµÄËùÓÐµµ°¸£¬(ÔÚ±¾ÀýÖÐ£¬ÎÒÃÇÊÇ´Ó {\ttfamily \~{}} ÕâÀï¿ªÊ¼Ñ°ÕÒ£¬Ò²¾ÍÊÇ \$HOME µÄÄ¿Â¼)¡£
ËýµÄÊä³ö½á¹û¿ÉÒÔÍ¸¹ýÐí¶àÌõ¼þÉè¶¨£¬¶ø´ïµ½Ðí¶à²»Ò»ÑùµÄÐèÇó¡£ÀýÈç {\ttfamily -name} ¡£

{\bfseries ÎÊÌâ}: ÎÒÏëÕÒÒ»¸öµµ°¸ÄÚµÄÄ³Ò»¸ö×Ö£¬ÀýÈç 'entropy'£¬ÎÒÒªÈçºÎ×÷ÄØ£¿ÓÐÃ»ÓÐÀàËÆÏñ {\ttfamily SEARCH} ÕâÖÖÖ¸ÁîÄØ?

{\bfseries ½â¾ö·½°¸}: ÓÐµÄ, ÊÔÊÔ¿´ grep Õâ¸öÖ¸Áî£º

\begin{tscreen}
\begin{verbatim}
$ grep -l 'entropy' *
\end{verbatim}
\end{tscreen}


ËµÃ÷£º£ª±íÊ¾ËùÓÐµÄµµ°¸¡£

{\bfseries ÎÊÌâ}: ÔÚÄ³¸öµØ·½£¬µÄÄ³¸öµµ°¸µÄÄÚÈÝÓÐ 'entropy' Õâ¸ö×Ö, ÎÒÏëÖªµÀÊÇÄÄÒ»¸öµµ°¸£¬ÇÒ·ÅÔÚÄÄÀï£¬
ÔÚ VMS ÉÏÎÒ¿ÉÒÔÊ¹ÓÃ {\ttfamily search entropy
[...]*.*;*}, µ«ÊÇ {\ttfamily grep} Õâ¸öÖ¸Áî²»¿ÉÒÔÊÕÑ°×ÓÄ¿Â¼£¬ÏÖÔÚÎÒÒªÈçºÎ½â¾öÄØ£¿

{\bfseries ½â¾ö·½°¸}: 

\begin{tscreen}
\begin{verbatim}
$ find . -exec grep -l "entropy" {} \; 2> /dev/null
\end{verbatim}
\end{tscreen}


ËµÃ÷: {\ttfamily find .} Êä³ö´ÓÄ¿Ç°Õâ¸öÄ¿Â¼ÏÂËùÓÐµÄµµ°¸£¨°üº¬Õâ¸öÄ¿Â¼ÏÂËùÓÐ×ÓÄ¿Â¼£©£¬
{\ttfamily -exec grep -l "entropy"} ÊÇ¶ÔÃ¿Ò»±ÊÓÉ find ´«³öÀ´µÄµµ°¸ÖØ¸´Ö´ÐÐÖ´ÐÐ(represented by {\ttfamily $\{$$\}$}), 
{\ttfamily $\backslash$} 
Îª½áÊøÕâ¸öÖ¸Áî¡£Èç¹ûÄú¾õµÃµÄÐ©¶«Î÷Ì«¿ÉÅÂÁË£¬Ã»´í£¬²»¹ýÄú¿ÉÒÔÊÔÖøÐ´Ð´ÏÂÃæµÄ Script¡£



\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
#!/bin/sh
# rgrep: recursive grep
# µÝ»ØÊ½ß¢È¡

if [ $# != 3 ]
then
  echo "Usage: rgrep --switches 'pattern' 'directory'"
  exit 1
fi
find $3 -name "*" -exec grep $1 $2 {} \; 2> /dev/null
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


ËµÃ÷: {\ttfamily grep} ¾ÍÏñ {\ttfamily search}, ½áºÏÁË
{\ttfamily find} £¬ÎÒÃÇµÃµ½ÁËÁ½ÕßµÄ¾«»ª¡£

{\bfseries ÎÊÌâ}: ÎÒÓÐÒ»¸ö×ÊÁÏµµ°¸£¬Õâ¸öµµ°¸¹²ÓÐÁ½ÁÐµµÍ·(header lines)£¨Ò²¾ÍÊÇËµ£¬µÚÈý±Ê×ÊÁÏ²ÅÊÇÎÒÕæÕýµÄ×ÊÁÏ£©£¬
Èç¹ûÎÒÏëÒªß¢È¡Ã¿±Ê×ÊÁÏµÄµÚ¶þºÍµÚÎåÀ¸µÄ×ÊÁÏ£¬ÎÒÐèÒªÐ´Ò»¸ö Fortran µÄ³ÌÊ½Âð£¿

{\bfseries ½â¾ö·½°¸}: ²»ÐèÒª¡£À´¿´¿´Õâ¸ö¾ßÓÐÉ±ÉËÁ¦µÄÖ¸Áî£¡

\begin{tscreen}
\begin{verbatim}
$ awk 'NL > 2 {print $2, "\t", $5}' datafile.dat > newfile.dat
\end{verbatim}
\end{tscreen}


ËµÃ÷: {\ttfamily awk} Õâ¸öÖ¸ÁîÊµ¼ÊÉÏ¿ÉÒÔËµÊÇÒ»ÖÖ³ÌÊ½ÓïÑÔ£ºÉÏÃæµÄÒâË¼ÊÇËµ£º
ÔÚ {\ttfamily datafile.dat} Õâ¸öµµ°¸Àï£¬´Óµµ°¸µÄµÚÈýÐÐ¿ªÊ¼µÄÃ¿Ò»ÐÐ£¬Ó¡³öÃ¿Ò»ÐÐµÄµÚ¶þºÍµÚÎåÀ¸Î»£¬
ÒÔ tab Îª·Ö¸ô·ûºÅ¡£Ñ§»áÁË {\ttfamily awk} Ò»¶¨»áÈÃÄúÊÂ°ë¹¦±¶µÄ¡£

{\bfseries ÎÊÌâ}: ÎÒ´Ó FTP Õ¾ÏÂÔØÁË {\ttfamily ls-lR.gz} Õâ¸öµµ°¸£¬ÏëÒª²ì¿´µµ°¸ÄÚÈÝ¡£
¶ÔÃ¿Ò»¸ö×ÓÄ¿Â¼¶øÑÔ£¬ËýÓÐÒ»ÐÐÐ´Ëµ "total xxxx", ÆäÖÐ xxxx ±íÊ¾µµ°¸´óÐ¡£¨kbytes£©
ÎÒÏëÖªµÀËùÓÐ xxxx ÖµµÄ×ÜºÍ£¬ÎÒÒªÈçºÎ×÷ÄØ£¿

{\bfseries ½â¾ö·½°¸}:

\begin{tscreen}
\begin{verbatim}
$ zcat ls-lR.gz | awk ' $1 == "total" { i += $2 } END {print i}'
\end{verbatim}
\end{tscreen}


ËµÃ÷: {\ttfamily zcat} ¿ÉÒÔÁÐ³ö {\ttfamily .gz} µÄµµ°¸ÄÚÈÝ¡£È»áá½« zcat µÃµ½µÄ½á¹û×ªËÍ(pipe)µ½
{\ttfamily awk}¡£¿´µ½ÁË°É£¡ÁË½â awk ÕæµÄ¶ÔÄúÓÐºÜ´óµÄ°ïÖúà¸¡£RMP£¡

{\bfseries ÎÊÌâ}: ÎÒÒÑ¾­Ð´ÁËÒ»Ö» {\ttfamily myprog} µÄ Fortran µÄ³ÌÊ½£¬¿ÉÒÔ¼ÆËãÓÉÃüÁîÁÐ´«½øÀ´µÄµµ°¸µÄ×ÊÁÏ£¬
¿ÉÊÇ£¬ÎÒÓÐºÜ¶à¸ö×ÊÁÏµµÐèÒªÊäÈëµ½ÕâÖ»³ÌÊ½£¬Ã¿Ò»¸öµµ°¸½«»áÓÐÒ»¸ö½á¹ûµµ°¸¡£µ«ÊÇÃ¿´Î¶¼ÒªÊäÈëµµÃûÊµÔÚºÜ·³ÈË£¬
ÔÚ VMS ÉÏ£¬ÎÒÐèÒªÐ´Ò»¸öÂÞËôµÄÃüÁîµµ(command file)²Å¿ÉÒÔ½â¾ö£¬ÄÇ÷áÔÚ Linux ÉÏÄØ£¿

{\bfseries ½â¾ö·½°¸}: Ö»ÒªÒ»¸öÐ¡Ð¡µÄ Script ¾Í¿ÉÒÔ½â¾öÁË¡£ÐÞ¸ÄÄúµÄ³ÌÊ½£¬ÈÃÄúµÄ³ÌÊ½¿ÉÒÔÔ¤¶¨¶ÁÈë '{\ttfamily mydata.dat}' Õâ¸öµµ°¸£¬
½«½á¹ûÊä³öµ½Ó©Ä»(stdout), È»áá±à¼­ÏÂÃæµÄ Script£º

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
#!/bin/sh
# myprog.sh: run the same command on many different files
# usage: myprog.sh *.dat
for file in $*  # for all parameters (e.g. *.dat)
do
  # append the file name to result.dat
  echo -n "${file}:    " >> results.dat
  # copy current argument to mydata.dat, run myprog 
  # and append the output to results.dat
  cp ${file} mydata.dat ; myprog >> results.dat
done
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


{\bfseries ÎÊÌâ}: ÎÒÏ£Íû½«ËùÓÐµµ°¸ÄÚµÄ `geology' ×ÖÌæ»»³É `geophysics' £¬ÎÒÐèÒªÊÖ¶¯±à¼­Âð£¿£¡

{\bfseries ½â¾ö·½°¸}: ²»ÐèÒª¡£ ÏÂÃæµÄ Shell Script ¿ÉÒÔ°ïÄú°ìµ½£º

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
#!/bin/sh
# replace $1 with $2 in $*
# usage: replace "old-pattern" "new-pattern" file [file...]
OLD=$1          # first parameter of the script
NEW=$2          # second parameter
shift ; shift   # discard the first 2 parameters: the next are the file names
for file in $*  # for all files given as parameters
do
# replace every occurrence of OLD with NEW, save on a temporary file
  sed "s/$OLD/$NEW/g" ${file} > ${file}.new
# rename the temporary file as the original file
  /bin/mv ${file}.new ${file}
done
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


{\bfseries ÎÊÌâ}: ÎÒÓÐÒ»Ð©µµ°¸£¬ÎÒ²»ÖªµÀËýÃÇµÄµµ°¸³¤¶È£¬ÎÒ±ØÐëÒÆ³ýÕâÐ©µµ°¸ÄÚµÄµ¹ÊýµÚ¶þºÍµ¹ÊýµÚÈýÐÐ£¬ÐèÒªÊÖ¶¯Âð£¿

{\bfseries ½â¾ö·½°¸}: µ±È»²»ÐèÒª£¬»¹ÊÇÊ¹ÓÃ Shell Script:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
#!/bin/sh
# prune.sh: removes n-1th and n-2th lines from files
# usage: prune.sh file [file...]
for file in $*   # for every parameter
do
  LINES=`wc -l $file | awk '{print $1}'`  # ¼ÆËã×Ü¹²ÓÐ¼¸ÐÐ
  LINES=`expr $LINES - 3`                 # LINES = LINES - 3 
  head -n $LINES $file > $file.new        # Êä³öÇ° LINES ÐÐ
  tail -n 1 $file >> $file.new            # ÔÙ½«×îááÒ»ÐÐ¸½¼Óµ½µµ°¸×îáá
done
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


Ï£ÍûÒÔÉÏÕâÐ©ÊµÀýÔö¼ÓÄú²»ÉÙµÄÊ³Óû...






\section{²»¿ÉÉÙµÄÐ¡Æ«·½}



\begin{itemize}
\item  {\bfseries Command completion}: µ±ÄúÔÚÃüÁîÁÐÓûÊäÈëÄ³Ò»Ö¸ÁîµÄÊ±ºò£¬Äú²»ÐèÒªÍêÈ«ÊäÈëÕâ¸öÖ¸ÁîµÄËùÓÐÃû³Æ£¬
ÊäÈëÇ°¼¸¸ö×ÖÔªáá£¬ÔÙ°´ $<$TAB$>$ £¬ÏµÍ³»á°ïÄúÍê³ÉÊäÈëËùÓÐµÄÖ¸ÁîÃû³Æ; ÀýÈç: 
Äú±ØÐëÊäÈë {\ttfamily less this\_is\_a\_long\_name}; ÏÖÔÚÄúÖ»ÒªÊäÈë {\ttfamily less thi$<$TAB$>$} 
ÏµÍ³¾Í»á°ïÄúÊäÈëÊ£ÏÂµÄ²¿·Ý£¬²»ÐèÒªÔÙÊéÈçÈ«²¿µÄµµÃûÁË¡£
(Èç¹ûÄúÓÐºÜ¶àµµ°¸¶¼ÊÇÒÔÕâÐ©×ÖÔª×÷¿ªÍ·£¬µ±È»ÏµÍ³¾Í»áÏÔÊ¾³öËùÓÐÒÔÕâ¼¸¸ö×ÖÔª¿ªÍ·µÄµµ°¸£¬µ«ÊÇ£¬Äú¿ÉÒÔÊäÈë×ã¹»µÄ×ÖÔª£¬¾Í¿ÉÒÔµÃµ½ÄúÐèÒªµÄÎ¨Ò»µµ°¸¡£)
\item  {\bfseries Back-scrolling}: Í¬Ê±°´ SHIFT--PAG UP ¿ÉÒÔÈÃÄúµÄÓ©Ä»Íù»Ø¾íµ½ÒÔÇ°ÏÔÊ¾¹ýµÄ£¬
µ«ÊÇ¿ÉÒÔÍù»Ø¾í¼¸Ò³£¬ÔòÐèÒªÊÓÄúµÄÏÔÊ¾¿¨µÄ¼ÇÒäÌå¶ø¶¨ÁË¡£
\item  {\bfseries Resetting the screen}: ²»¹ûÄú²»Ð¡ÐÄÓÃ {\ttfamily more} »ò {\ttfamily cat} 
¿ªÆôÁËÒ»¸ö¶þ½øÎ»µµ(binary file), ÄÇÄúµÄÓ©Ä»¿ÉÄÜÎªÒò´Ë¶øÂÒµô¡£ÕâÊ±ºòÄú¿ÉÒÔÊ¹ÓÃ
{\ttfamily reset} »òÊÇÊ¹ÓÃ {\ttfamily echo CTRL-V ESC c RETURN} ¿ÉÒÔÈÃÄúµÄÓ©Ä»»Ö¸´Õý³£¡£
\item  {\bfseries Pasting text}: ÔÚ X ÏÂ£¬ÒÔ»¬ÊóÔÚ {\ttfamily xterm} ÊÓ´°ÍÏÒ·³öÒ»¸öÇøÓò£¬
È»áá°´»¬ÊóÖÐ¼ü£¨Èç¹ûÄúµÄ»¬ÊóÃ»ÓÐÖÐ¼ü£¬¿ÉÒÔÍ¬Ê±°´»¬ÊóµÄ×óÓÒ¼üÄ£ÄâÖÐ¼ü£©¾Í¿ÉÒÔÌùÉÏÄú¸´ÖÆµÄÎÄ×Ö¡£
\item  {\bfseries Using the mouse}: ÔÚÖÕ¶Ë»úÄ£Ê½ÏÂ£¬Äú¿ÉÄÜÐèÒªÑ°ÎªÄúµÄÏµÍ³¹ÜÀíÔ±ÓÐÃ»ÓÐ°²×° {\ttfamily gpm} ÕâÖ»³ÌÊ½, 
Èç¹ûÓÐ£¬Äú¾Í¿ÉÒÔÓÃ»¬ÊóÍÏÒ·³öÒ»¸öÇøÓò£¬È»áá°´»¬ÊóµÄ×ó¼ü£¬¾Í¿ÉÒÔÌùÉÏÄú¸Õ¸ÕÍÏÒ·³öÀ´µÄÎÄ×ÖÇøÓò¡£
£¨²»Í¬µÄÐéÄâÖÕ¶Ë»ú(VC)¿ÉÄÜ»áÓÐ²»Ò»ÑùµÄ²Ù×÷·½Ê½£©¡£
\end{itemize}







\section{ÔÚ Linux ÉÏ¶ÁÈ¡ VMS µÄ´Å´ø}



(ÒÔÏÂÕâ¶ÎÊÇÓÉ Mike Miller ÏÈÉúËùÖø)




\subsection{¼ò½é}



ÓÐÊ±ºòÄú¿ÉÄÜÐèÒª¶ÁÓÉ VMS ×ö³öÀ´µÄ´Å´ø£¨»òÊÇÎªÁËÈÃ VMS µÄ»úÆ÷ºÍ *nix ÏµÍ³¿ÉÒÔ¶ÁÈ¡µÄ´Å´ø£©£¬
´óÖÂÉÏ£¬¶Ô DECFILES11A ´Å´ø²¢²»»áÌ«ÄÑ¡£

»òÐíÄúÔø¶Á¹ý Linux µÄ mini-HOWTO, µ«ÊÇ£¬ÎÒÏàÐÅ£¬ÎÒÔÚÕâÀïÌá¼°µÄÒ»Ð©¹ÛÄîÒ²ÊÇºÍÈÎºÎÒ»ÖÖ *nix ÏµÍ³¡£
ÎÒÔø¾­ÔÚ Linux, HP, Sun and DEC *nix µÈÏµÍ³ÖÐÊÔ¹ý¡£±È½Ï²»Ò»ÑùµÄµØ·½ÊÇ£¬Ã¿ÖÖ×÷ÒµÏµÍ³¶Ô×°ÖÃÃû³Æ£¨device names£©¿ÉÄÜ»áÓÐËù²»Í¬£¬
¶ø mt ÔÚÖ¸Ã÷×°ÖÃÃû³Æ(device name)µÄÊ±ºò£¬ÆäÑ¡Ïî(options)Ò²¿ÉÄÜÒò×÷ÒµÏµÍ³¶øÒì¡£
ÀýÈç£ºÔÚ Linux ÉÏÊÇ mt -f £¬µ«ÊÇÔÚ HPUX 9 ÉÏÈ´ÊÇ mt -t¡£



×¢Òâ - ÎÒÖ»ÒÔ Exabyte 8mm SCSI tape drives Êµ×÷¹ý£¬Èç¹ûÄúÒÑ¾­¶Á¹ýÆäËûµÄ¸ñÊ½£¬
ÇëÈÃÎÒÖªµÀ£¬ÎÒ½«»á°ÑËýÔö¼Óµ½Õâ·Ý Note ÖÐ¡£






\subsection{Ò»Ð©»ù±¾³£Ê¶}



µ±¶ÁÈ¡ VMS ÓÉ ``copy'' Ö¸Áî×÷³ÉµÄ´Å´øÊ±£¬£¨»òÊÇ¿´ÆðÀ´ÏñÊÇÓÉ copy Ö¸Áî×÷³ÉµÄ´Å´ø£©£¬
Äú±ØÐëÒªÖªµÀ£¬Ã¿¸öÊµ¼ÊµÄµµ°¸½«»á·Ö³ÉÈýµÄµµ°¸´æ·ÅÔÚ´Å´øÉÏ£¬·Ö±ðÊÇ¡°µµÍ·(header)¡±, ¡°×ÊÁÏ(data)¡±, ºÍ¡°µµÎ²(trailer)¡±¡£
ÆäÖÐµµÍ·(header) ºÍ µµÎ²(trailer)´æ·ÅÖøµµ°¸µÄÑ¶Ï¢£¬ºÍÔÚ VMS ÉÏµÄÎ»ÖÃ¡£¶ø×ÊÁÏ(data)µ±È»¾ÍÊÇ´æ·ÅÔ­À´µÄ×ÊÁÏÀ²£¡
ÕâÐ©µµ°¸¶¼¿ÉÒÔÓÉ dd Õâ¸öÖ¸Áî´Ó´Å´ø(tape)ÉÏÝÍÈ¡³öÀ´¡£
ÓÉ mt Ö¸Áî£¬¿ÉÒÔ½«´Å´ø×ªµ½ËùÐèÒªµÄÎ»ÖÃ¡£

¡õÀý£ºÎÒÓÐÒ»¸öÁ¬Ðø´æ·ÅÖøµµ°¸µÄ´Å´ø¡£×îÇ°ÃæÁ½¸öÔÚ VMS ÉÏµÄµµÃûÎª ce66-2.evt ºÍ ce66-3.evt 
´Å´øµÄ±êÇ©(label)ÊÇ c66a2¡£

Èç¹ûÎÒÖ´ÐÐÏÂÁÐÖ¸Áî£º

\begin{tscreen}
\begin{verbatim}
> dd if=$TAPE bs=16k of=header1
> dd if=$TAPE bs=16k of=data1
> dd if=$TAPE bs=16k of=trailer1
> dd if=$TAPE bs=16k of=header2
> dd if=$TAPE bs=16k of=data2
> dd if=$TAPE bs=16k of=trailer2
\end{verbatim}
\end{tscreen}


ÎÒ dd ÁËÁù¸öµµ°¸£ºheader1, data1, trailer1, header2, data2 ºÍ trailer2.  
Ê¹ÓÃÓï·¨ÈçÏÂ£ºif="input file", bs="block size" ºÍ of="output file".  
TAPE Õâ¸ö±ãÊÇÐëÊÓÄúµÄ»úÆ÷ÉÏµÄ×°ÖÃÃû³Æ¶ø¶¨£¬ÀýÈç£ºÈç¹ûÄúÔÚ Linux ÉÏÊ¹ÓÃ SCSI µÄ´Å´ø×°ÖÃ£¬
ÄúµÄ×°ÖÃÃû³Æ¿ÉÄÜÊÇ /dev/nts0 ¡£

Èç¹ûÄúÏëÒª¶ÁµÚ¶þ¸öµµ°¸£¬²»ÊÇµÚÒ»¸ö¡£Äú²»ÔÚÒâµµÍ·(header)£¬¶øÇÒÄúÏëÒªÊ¹ÓÃÔ­À´µÄµµÃû£¬Äú¿ÉÒÔÕâ÷á×÷£º

\begin{tscreen}
\begin{verbatim}
> mt -f $TAPE fsf 4
> dd if=$TAPE bs=16k of=ce66-2.evt
> mt -f $TAPE fsf 1
\end{verbatim}
\end{tscreen}


×¢Òâ ¡°4¡± - Ìø¹ýµÚÒ»¸öµµ°¸Ëù¸½ÊôµÄÈý¸öµµ°¸£¬ËùÒÔÏÂÒ»±È£¨µÚ¶þ±Ê£©µÄµµÍ·½«»áÊÇ´ÓµÚËÄ±Ê¿ªÊ¼¡£
µÚ¶þ¸ö mt ÎªÌø¹ýµÚ¶þ±Êµµ°¸µÄµµÎ²(tailer)²¢ÇÒÖ¸µ½ÏÂÒ»±Êµµ°¸(µÚÈý±Ê×ÊÁÏµÄµµÍ·)¡£
µ±È»£¬ÄúÒ²¿ÉÒÔÊ¹ÓÃ mt Ê¹´Å´ø¿ì×ª(bsf), µ¹×ª(rewind)£¬»òÊÇ ´ÅÍ·¹éÎ»(offline, rewoffl).




\subsection{¸ü¶àÏ¸½Ú}



µµÍ·(header) ºÍ µµÎ²(trailer) °üº¬ÁË¸ø VMS ´¢´æµµ°¸µÄÒ»Ð©Ñ¶Ï¢£¬ÀýÈçÇø¿é´óÐ¡(block size)¡£
Í¬Ê±ËýÃÇÒ²°üº¬ÁËµµ°¸Ãû³Æ£¬·½±ãÄú½¨Á¢ Script µµÀ´×Ô¶¯¶ÁÈ¡µµ°¸»òÊÇËÑÑ°ÌØ¶¨µÄµµ°¸¡£
È»¶ø£¬ÔÚ´Å´øÉÏµÄµÚÒ»¸öµµÍ·µµ(header file)£¬ºÍÆäËû´Å´øÉÏµÄµµÍ·µµÓÐÐ©ÐíµÄ²îÒì¡£

¶Ôì¶ÔÚ´Å´øÉÏµÄµÚÒ»¸öµµ°¸(¼ÙÉèÎª header1)£¬×îÇ°ÃæµÄËÄ¸ö×ÖÔª½«»áÊÇ "VOL1" £¬Æäáá°éËæÖø°æ±¾Ãû³Æ(volume name)¡£
±¾ÀýÖÐ£¬header1 µÄ×î³õÄÚÈÝÓ¦¸ÃÊÇ "VOL1C66A2"¡£ËæááÊÇÒ»¸ö×Ö´®"HDR1" £¬±íÊ¾ÕâÊÇÒ»¸öµµÍ·µµ(header file)¡£
È»áá²ÅÊÇµµ°¸Ãû³Æ(file name)¡£±¾ÀýÖÐ£¬Ëý»áÊÇ "HDR1CE66-2.EVT"¡£ÏÂÒ»¸öÀ¸Î»ÓÖÊÇ°æ±¾Ãû³Æ(volume name)¡£

¶Ôì¶ÆäËûµÄ²»ÊÇ´Å´øÉÏµÚÒ»¸öµµÍ·µµµÄµµÍ·µµ£¬×î³õµÄ VOL1 À¸Î»½«²»»á´æÔÚ¡£
ÆäËûµÄÀ¸Î»¾ÍºÍÇ°ÃæËù½éÉÜµÄµÚÒ»¸öµµÍ·µµµÄ½á¹¹Ò»Ä£Ò»Ñù¡£ÁíÒ»¸ö±È½ÏÓÐÓÃµÄÀ¸Î»ÊÇµÚÆß¸öÀ¸Î»¡£
ËýÊÇÒÔ "DECFILES11A" Îª½áÎ²¡£Ëý±ØÐë´æÔÚ£¬ÓÃ»¹È·ÈÏ DEC Files11A standard.

\begin{tscreen}
\begin{verbatim}
       field     initial header         subsequent headers
       =====     =============          ==================
         1       VOL1 + volume name     HDR1 + file name
         2       3HDR1 + file name      volume name
         3       volume name            

         6                              ...DECFILES11A
         7      ...DECFILES11A
\end{verbatim}
\end{tscreen}


ÆäËû¸üÏêÏ¸µÄµµÍ·ºÍµµÎ²µÄ½á¹¹£¬Çë²Î¿¼ DEC FILES11A µÄËµÃ÷ÎÄ¼þ¡£
(on the orange/grey wall - ask your local VMS folks :-).






\subsection{Çø¿é´óÐ¡µÄ½¨Òé(Block Size)}



ÔÚÀý×ÓÖÐ£¬ÎÒÊ¹ÓÃµÄÇø¿é´óÐ¡ÊÇ 16K¡£ÔÚ *nix ÏµÍ³ÉÏ£¬´ÅµúÉÏµÄµµ°¸²¢Ã»ÓÐºÍÇø¿é´óÐ¡ÓÐ¹ØÁ¬£¬
È»¶ø£¬ÔÚ VMS ÉÏ£¬Ã¿Ò»¸öµµ°¸¶¼ÓÐÒ»¸öÃ÷È·µÄÇø¿é´óÐ¡(block size)¡£Ò²¾ÍÊÇËµ£¬ÔÚ Linux ¶Ë£¬
Çø¿é´óÐ¡²¢Ã»¶àÌ«´óµÄ¹ØÏµ£¬³ý·Çµ±²»ÈÝÒ×´Ó´Å´øÖÐ¶Á³öµµ°¸µÄÊ±ºò¡£Èç¹ûÄúÕÒ²»µ½Çø¿é´óÐ¡(block size)£¬
Äú¿ÉÒÔÊÔÖøÔÚ´Åµú×°ÖÃÉÏ£¬ÓÃ `mt -f \$TAPE setblk 0' À´Éè¶¨Ó²ÌåµÄÇø¿é´óÐ¡¡£
ÓÃ setblk Ñ¡ÏîµÄÝÍÈ¡µÄÐÎÊ½¿ÉÄÜ»áËæÖø mt µÄ°æ±¾²»Í¬¶øÓÐËù²»Ò»Ñù£¬
ÄúµÄ´Å´ø×°ÖÃµÄÓ²Ìå½çÃæ£¬»¹ÓÐÄúÏ²°®µÄ *nix ÏµÍ³Ò²ÏëÏàµ±µÄ¹ØÏµ¡£

(¸ÐÐ» Wojtek Skulski (\nameurl{skulski@nsrlc6.nsrl.rochester.edu}{}) 
Ìá³ö setblk Ïà¹Ø²¿·Ý.)






\section{×Ü½á}






\subsection{°æÈ¨}



³ý·ÇÓÐÌØ±ðÉùÃ÷£¬Linux HowTo ÎÄ¼þµÄ°æÈ¨¹éì¶¸ö±ð£¨Ô­£©×÷ÕßËùÓÐ¡£
Ö»ÒªÕâ·Ý°æÈ¨ÉùÃ÷±£ÁôÔÚËùÓÐµÄÎÄ¼þÖÐ£¬Linux HowTo ÎÄ¼þ¿ÉÒÔÈ«²¿»ò²¿·ÝµØÒÔÈÎºÎÐÎÊ½µÄÃ½ÌåÐÞ¸Ä»òÉ¢²¥¡£
ÉõÖÁÔÊÐíÓÐÓªÀûÐÔÖÊµÄÐÐÎª¡£È»¶ø£¬Ï£ÍûÄÜÏÈÖª»áÔ­×÷ÕßÏà¹ØÎÄ¼þµÄÉ¢²¼¡£

ÈÎºÎµÄ·­Òë£¬ÒýÓÃ£¬»òÊÇÕûºÏµÄ×÷Æ·£¬·²°üº¬µ½ Linux HowTo ÎÄ¼þÕß£¬¶¼Êôì¶Õâ·Ý°æÈ¨ÉùÃ÷µÄ¡õÎ§¡£
Ò²¾ÍÊÇËµ£¬Äú²»ÔÊÐí´Ó HOWTO ÖÐ·¢±íÑÜÉú×÷Æ·£¬»òÊÇÔö¼Ó¶îÍâµÄÏÞÖÆ¡£
µ«ÔÚÄ³Ð©¼Ù¶¨µÄÇé¿öÏÂ£¬ÕâÐ©¹æ¶¨¿ÉÒÔÓÐÀýÍâ¡£Ïà¹ØÏ¸½ÚÇëÁªÏµ Linux HOWTO µÄÐ­µ÷ÈË¡£
Á¬Âç·½Ê½¿ÉÔÚÏÂÎÄÖÐÕÒµ½¡£

×ÜÖ®£¬ÎÒÃÇÏ£Íû¾¡¿ÉÄÜµÄÍ¸¹ýÈÎºÎÐÎÊ½µÄ¹ÜµÀÌáÉýÕâ·ÝÎÄ¼þµÄÐû´«¡£µ«ÊÇÎÒÃÇÏ£ÍûÄÜ¹»±£ÁôÕâ·Ý°æÈ¨ÉùÃ÷¡£
²¢ÇÒÈçÓÐÈÎºÎµÄÐÞ¸Ä£¬ÎÒÃÇ½«»áºÜÀÖÒÔµÄ±»¸æÖª¡£

Èç¹ûÄúÓÐÈÎºÎµÄÒÉÎÊ£¬ÇëÁ¬ÁªÏµ Linux HOWTO µÄÐ­µ÷Õß Tim Bynum£¬
Äú¿ÉÒÔÊ¹ÓÃ email: \nameurl{linux-howto@sunsite.unc.edu}{} ÓëÆäÁªÏµ¡£






\subsection{ááÐò}



Õâ·Ý×÷Æ·ÊÇÎÒÔÚ Settore di Geofisica of the Universita' di Bologna (Italy) µÄÊµ×÷¾­Ñé¡£
Æä VAX 4000 Ò²ÒÑ¾­±»ÒÔ Linux Îª×÷ÒµÏµÍ³µÄ±¼ÌÚ(pentium)µÄ¸öÈËµçÄÔËù´úÌæÁË¡£
ÎÒ´ó²¿·ÖµÄÍ¬ÊÂÒÔÇ°¶¼ÊÇ VMS µÄ°®ÓÃÕß£¬¿ÉÊÇÏÖÔÚËýÃÇ¶¼ÒÑ¾­×ª»»µ½ Linux ÉÏÁË¡£

``From VMS to Linux HOWTO''£¨´Ó VMS µ½ Linux£©Õâ·ÝÎÄ¼þÖ÷ÒªÊÇÓÉ Guido Gonzato Ëù×«Ð´µÄ, \nameurl{guido ``at'' ibogeo.df.unibo.it}{}, Mike Miller ÏÈÉú, 
\nameurl{miller5@uiuc.edu}{}, Ëû¹±Ï×ÈçºÎ´Ó Linux ÉÏ¶ÁÈ¡ VMS µÄ±¸·Ý´Å´øÕâÒ»²¿·ÝÎÄÕÂ¡£
Ê®·Ö¸ÐÐ»ÎÒµÄÍ¬ÊÂºÍÅóÓÑÃÇ£¬ËûÃÇ°ïÎÒ½âÊÍÁË´ó²¿·Ö VMS Ê¹ÓÃÕßµÄÐèÒªºÍÏ°¹ß£¬ÓÈÆä¸ÐÐ» Dr. Warner Marzocchi¡£

Çë°ïÎÒ¸ÄÉÆÕâ·Ý HOWTO ÎÄ¼þ¡£ÒòÎªÎÒ²»ÊÇ VMS ×¨¼Ò£¬¶øÇÒÒ²²»¿ÉÄÜÊÇ£¬ËùÒÔÊ®·Ö»¶Ó­ÄúµÄ½¨Òé£¬ºÍ´íÎó»Ø±¨¡£

»¶Ó­Äú½øÈë Linux µÄµîÌÃ,

Guido {\ttfamily =8-)}






\subsection{ÒëÕßÐò}

ÔÚ·­ÒëÕâÆªÎÄÕÂµÄÊ±ºò£¬ÎÒ±ß·­Òë±ßÏë£¬Ì¨ÍåÏÖÔÚ»¹ÓÐÈËÔÚÊ¹ÓÃ VMS Âð£¿
ÉõÖÁ»¹²»ÊÇºÜ¶àÈËÖªµÀ VMSÄØ£¡µ±ÎÒ·­ÒëÍêáá·¢ÏÖ£¬ÆäÊµÕâÆªÎÄÕÂ²»Ö»ÊÊºÏ VMS µÄÊ¹ÓÃÕß£¬
ÈÎºÎÏëÒª½øÈë Linux ÊÀ½çµÄÈË¶¼¿ÉÒÔ²Î¿¼¿´¿´£¬ÒòÎª£¬ÕâÆªÎÄÕÂµÄ¹ÛÄî»¹²»ËãÌ«ÄÑ£¬
¶ÁÍêáá£¬´óÖÂÉÏ¿ÉÒÔÁË½â Linux µÄ»ù±¾²Ù×÷¡£(ÉõÊÇÄú¿ÉÒÔ°ÑËûÏëÏñ³É´Ó dos µ½ Linux£©¡£
µ«ÊÇ£¬ËµÕæµÄ£¬¹âÆ¾ÕâÆªÎÄÕÂ»¹ÊÇ²»¹»µÄ£¬ÎÒÏë£¬Èç¹û Linux µÄÂ·Òª×ßµÃÆ½Ë³Ò»µãµÄ»°£¬
ÂòÒ»±¾ºÃÊé¾ø¶ÔÊÇ±ØÒªµÄ¡£

»òÐí£¬ÓÐÐ©µØ·½·­µÄ²»ÊÇºÜÌùÇÐ£¬Èç¹ûÓÐºÃµÄ½¨Òé£¬»òÊÇÓÐÈÎºÎµØ·½µÄÎóÃý£¬
Çë²»Áß´Í½Ì£¡Linux µÄÊÀ½ç£¬ÊÇÒ»¸öËæÊ±ËæµØ¶¼ÔÚÑ§Ï°µÄÊÀ½ç£¡

Linux °®ºÃÕß,

·åÖÛ
email: \nameurl{sonnystone@kimo.com.tw}{}

Dec 27, 2000 ÓÚ MI¡£



\end{document}
