%% $Header: /cvsroot/lcdp/lpic/general-linux-1/slides/gl1.103.1.slides.tex,v 1.3 2003/05/30 05:09:04 waratah Exp $ \input{gl1.slide-header.tex} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %----10->|-----20->|-----30->|-----40->|-----50->|-----60->|-----70->|-----80-> \begin{slide} %================================================================ \begin{center} \LARGE \textsf{-- General Linux 1 -- \\ Work on the Command Line} \LARGE \textsf{[5] } \\[2mm] \large \textsf{(Linux Professional Institute Certification)}\\[1mm] \normalsize\end{center} \footnote{Copyright \copyright\ 2002 Geoffrey Robertson. Permission is granted to make and distribute verbatim copies or modified versions of this document provided that this copyright notice and this permission notice are preserved on all copies under the terms of the GNU General Public License as published by the Free Software Foundation---either version 2 of the License or (at your option) any later version.} \scriptsize \begin{verbatim} .~. /V\ by: geoffrey robertson // \\ geoffrey@zip.com.au @._.@ \end{verbatim} \tiny \begin{verbatim} $Id: gl1.103.1.slides.tex,v 1.3 2003/05/30 05:09:04 waratah Exp $ \end{verbatim} \normalsize \vfill \end{slide} %----------------------------------------------------------- %----10->|-----20->|-----30->|-----40->|-----50->|-----60->|-----70->|-----80-> %============================================================================== %============================================================================== \begin{slide} %ghr \slideheading{(1.3) GNU and UNIX Commands [31]} \begin{description} \item[1.103.1] {\bf \underline{Work on the command line [5]}} \item[1.103.2] Process text streams using filters [6] \item[1.103.3] Perform basic file management [3] \item[1.103.4] Use streams, pipes, and redirects [5] \item[1.103.5] Create, monitor, and kill processes [5] \item[1.103.6] Modify process execution priorities [3] \item[1.103.7] Search text files using regular expressions [3] \item[1.103.8] Perform basic file editing operations using vi [1] \end{description} \vfill \end{slide} %----------------------------------------------------------- %============================================================================== %============================================================================== \begin{slide} %ghr \slideheading{Work on the command line [5]} \slidesubheading{Objective} Candidate should be able to interact with shells and commands using the command line. This includes typing valid commands and command sequences, defining, referencing and exporting environment variables, using command history and editing facilities, invoking commands in the path and outside the path, using command substitution, applying commands recursively through a directory tree and using man to find about commands. \vfill \end{slide} %----------------------------------------------------------- %============================================================================== \begin{slide} %ghr \Slideheading{Work on the command line [5]} \slidesubheading{Key files, terms, and utilities} \begin{minipage}[t]{40mm} \begin{itemize} \item . \item bash \item echo \item env \item exec \item export \end{itemize} \end{minipage} % \begin{minipage}[t]{30mm} \begin{itemize} \item man \item pwd \item set \item unset \item \~{}/.bash\_history \item \~{}/.profile \end{itemize} \end{minipage} \vfill \end{slide} %----------------------------------------------------------- %============================================================================== \begin{slide} %ghr \Slideheading{Work on the command line [5]} \slidesubheading{Resources of interest} \begin{description} \item[LPI Certification in a Nutshell] pp15---19 \item[LPIC 1 Cert. Bible] Chapter 2 \item[Linux Shells by Example] by Ellie Quigley \end{description} \vfill \end{slide} %----------------------------------------------------------- %============================================================================== %============================================================================== \begin{slide}{} %aghr \overlay{} \slideheading{Shells} \slidesubheading{Command Line Interface} \begin{itemize} \item A shell is the program that provides a Command Line Interface to the operating system. \overlay{1} \item Shells may be accessed in various ways: \begin{itemize} \overlay{2} \item Virtual Console \overlay{3} \item Terminal attached to a serial line \overlay{4} \item Remote access over \textsf{tcp/ip} with \textsf{telnet}, \textsf{rsh} or \textsf{ssh} \overlay{5} \item An \textsf{X terminal} run on an X session, either on the local console or remotely \end{itemize} \overlay{6} \item See \texttt{/etc/inittab} \flushright $\Rightarrow$ \end{itemize} \vfill \end{slide} %----------------------------------------------------------- %============================================================================== \begin{slide}{} %aghr \overlay{} %\Slideheading{Shells} \slidesubheading{The Choice of Shells} The default GNU/Linux shell is the \textsf{Bourne Again Shell}---\texttt{bash}\\\cmd{echo \$SHELL}\\ \texttt{/bin/bash} \begin{description} \overlay{1} \item[sh] The name of the original Bourne shell, usually a link to \texttt{bash} \item[tcsh] An improved version of the UNIX C shell (\texttt{csh}) \item[ash] A small shell for use in tight spaces such as \textsf{tomsrtbt} \item[ksh] A copy of the \textsf{korn} shell \item[zsh] A vast and powerful shell \end{description} \flushright $\Rightarrow$ \vfill \end{slide} %----------------------------------------------------------- %============================================================================== \begin{slide}{} %ghr \overlay{} % \Slideheading{Shells} \slidesubheading{The \texttt{chsh} command} \begin{alltt} \cmd{chsh} Changing shell for geoffrey. Password: New shell [/bin/bash]: /bin/zsh Shell changed. \end{alltt} %\overlay{1} This changes \texttt{/etc/passwd}\\ \cmd{cat /etc/passwd |grep \^{}geoffrey}\\ \texttt{geoffrey:x:500:500:GHR:/home/geoffrey:/bin/zsh} \begin{itemize} % \overlay{2} \item List which shells are available to you\\ \cmd{chsh -l} % \overlay{3} \item Change to a new shell\\ \cmd{chsh -s ksh} \end{itemize} \vfill \end{slide} %----------------------------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slideheading{Shell Variables} \slidesubheading{Environmental Variables} \begin{itemize} \item View the contents of a variable: \begin{alltt} \cmd{echo $TERM} xterm \end{alltt} \item View the envionmental variables: \begin{alltt} \cmd{set} \end{alltt} \item Change a variable only in the current shell: \begin{alltt} \cmd{PS4=+} \end{alltt} \item Change a variable and make it environmental: \begin{alltt} \cmd{export PS4=+} \end{alltt} \end{itemize} \vfill \end{slide} %----------------------------------------------------------- %============================================================================== \begin{slide} \Slideheading{Shell Variables} \slidesubheading{The \texttt{bash} Prompts} \begin{itemize} \item The primary \texttt{bash} Prompt is set by the environmental variable \texttt{PS1}. \begin{verbatim} [geoffrey@marsbar ~/]$ echo $PS1 [\u@\h \W]\$ \end{verbatim} \item The secondary prompt is set by the variable \texttt{PS2} \begin{verbatim} $ cat /usr/share/texmf/tex/latex/lyx/chess.sty \ > grep blahblah tee /tmp/file.save \end{verbatim}%$ \item The tertiary prompt is set by \texttt{PS3} and is used by the \texttt{bash} shell structure \texttt{select}. \end{itemize} \vfill \end{slide} %----------------------------------------------------------- %============================================================================== \begin{slide} \Slideheading{Shell Variables} \slidesubheading{The \texttt{bash} prompt settings} \begin{verbatim} $ export PS1=[\u@\h \w]\$ ## not $PS1 [geoffrey@marsbar /usr/local]$ \end{verbatim} \begin{description} \item[$\backslash$ u] username \item[$\backslash$ h] host name \item[$\backslash$ \$] \$ for users and \# for root \item[$\backslash$ w] full path of current working directory \item[$\backslash$ W] base name of the current working directory \item[$\backslash$ !] history number of the current command \end{description} \vfill \end{slide} %----------------------------------------------------------- %============================================================================== \begin{slide} \Slideheading{Shell Variables} \slidesubheading{\texttt{\$PATH}} Add a directory to your path thus \begin{alltt} \cmd{PATH=\$PATH:/tmp} \end{alltt} \vfill \end{slide} %----------------------------------------------------------- %============================================================================== \begin{slide}{} %ghr \heading{The End} \Slidecontents \vfill \end{slide} %----------------------------------------------------------- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \end{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %============================================================================== %============================================================================== \begin{slide}{} \slideheading{} \vfill \end{slide} %----------------------------------------------------------- ============================================================================= \begin{slide}{} \end{slide} %------------------------------------------------------------------