%% $Header: /cvsroot/lcdp/lpic/general-linux-1/slides.tex,v 1.9 2003/05/30 04:45:24 waratah Exp $ \documentclass[a4]{seminar} \renewcommand{\slidefuzz}{1in} % Attempt to reduce overfull warnings. \renewcommand{\printlandscape}{\special{landscape}} \usepackage{times} \usepackage[dvips]{pstcol} % To use the standard `colour' package with Seminar \usepackage{semcolor} %list of slides \usepackage{semlayer} %overlays \usepackage{slidesec} \input{seminar.bug} \input{seminar.bg2} % See the Seminar bugs list \definecolor{LemonChiffon}{rgb}{1.,0.98,0.8} \usepackage{slidesec} \usepackage{epsfig} \usepackage{alltt} \usepackage{moreverb} \usepackage[dvips]{pstcol} %To use the standard 'colour' package with Seminar %\usepackage[dvips]{graphics} \usepackage{rotating} \usepackage{shapepar} \usepackage{ifthen} \usepackage{psfrag, graphicx} %\usepackage{graphpap} \usepackage{boxedminipage} %\usepackage{pict2e} %\usepackage{fancybox} %\usepackage{semcolor} \usepackage{pstricks,pst-node,pst-tree} \slideframe{plain} % plain, oval, Oval, shadow %\slideframe[\psset{fillcolor=blue}]{scshadow} % \psset uses PSTricks. \slidesmag{3} % Default is 4 = all fonts & spacing is scaled by 1.2^4 \renewcommand{\makeslideheading}[1]{% \begin{center} \psshadowbox[framearc=0.4,fillstyle=solid,fillcolor=red]{% \Large\textbf{\textsf{\textcolor{white}{\theslidesection{} -- #1}}}} \end{center}} \renewcommand{\makeslidesubheading}[1]{% \noindent\psframebox[framearc=0.4,fillstyle=solid,fillcolor=LemonChiffon]{% \Large\textbf{\theslidesubsection{} -- #1}}\par\vspace{0mm}} %\large\textbf{\theslidesection{}.\theslidesubsection{} -- #1}}\par} \newcommand{\slidesubsubheading}[1]{% \framebox{\large\textbf{\theslidesubsection{} -- #1}}\par\vspace{2mm}} \newcommand{\slidesubsubsubheading}[1]{% \box{\large\textbf{ #1}}\par\vspace{2mm}} \newcommand{\heading}[1]{% \framebox{\bf \normalsize \black \textrm{ {#1}}} \par\vspace{2mm} } % Personalise the format of the list of slides \makeatletter \def\listofslides{% \centerline{\LARGE\textbf{List of Slides}}% \def\l@slide##1##2##3{% \slide@dottedcline{##1 -- ##2}{\slidenumberline{##3}}}% \def\l@subslide##1##2##3{% \slide@dottedcline{\ \ ##1 -- ##2}{\slidenumberline{##3}}}% \@startlos} % To change formatting of subslides in list of slides (whole numerotation) \def\slide@subheading[#1]#2{% \stepcounter{slidesubsection}% \addtocontents{los}{\protect\l@subslide {\the\c@slidesection.\the\c@slidesubsection}{\ignorespaces#1}{\@SCTR}}% \gdef\theslidesubheading{#1}% \def\@tempa{#2}% \ifx\@tempa\@empty\else {\edef\@currentlabel{\csname p@slidesubsection\endcsname \theslidesubsection}\makeslidesubheading{#2}}% \fi} % To avoid Overfull messages on each line of th elist... \def\slide@dottedcline{\@dottedtocline{1}{0.3em}{1.5em}} \makeatother \newcommand{\cmd}[1]{% \texttt{\$ #1 \(\hookleftarrow\)} } \newcommand{\rootcmd}[1]{% \texttt{\# #1 \(\hookleftarrow\)} } \newcommand{\opt}[1]{% {\bf\texttt{#1}} } % For overlays, to force to print all preceding ones \makeatletter \def\pst@initoverlay#1{% \pst@Verb{% /BeginOL {dup (all) eq exch TheOL le or {IfVisible not {Visible /IfVisible true def} if} {IfVisible {Invisible /IfVisible false def} if} ifelse} def \tx@InitOL /TheOL (#1) def}} \makeatother \newcommand{\SlideColours}[3][black]{% \slideframe[\psset{linecolor=#1,fillcolor=#3,fillstyle=solid}]{scplain} \color{#2}} % \slash % \textasciitilde % \textasciicircum % \textgreater % \textless % \(\hookleftarrow\) % %\twoup[2] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %----10->|-----20->|-----30->|-----40->|-----50->|-----60->|-----70->|-----80-> \begin{slide} %==== Slide 1 ======================================== \begin{center} \Huge \textsf{-- General Linux 1 -- } \\ \large \textsf{(Linux Professional Institute Certification)} \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.} \begin{verbatim} .~. /V\ by: geoffrey robertson // \\ geoffrey@zip.com.au @._.@ \end{verbatim} \tiny \begin{verbatim} $Id: slides.tex,v 1.9 2003/05/30 04:45:24 waratah Exp $ \end{verbatim} \normalsize \vfill \end{slide} %--------------------------------------------------- %----10->|-----20->|-----30->|-----40->|-----50->|-----60->|-----70->|-----80-> %============================================================================== \begin{slide} \listofslides \vfill \end{slide} %------------------------------------------------------------------------------ %============================================================================== \begin{slide}\setcounter{slidesection}{102} \begin{minipage}[t]{5mm} \verb+ + \end{minipage} % \begin{minipage}[t]{10mm} \vspace{65mm} \begin{rotate}{90} \fbox{\Huge \hspace{0mm} \textbf{General Linux 1}} \end{rotate} \end{minipage} % \begin{minipage}[t]{110mm} \Large \vfill \begin{itemize} \item (1.3) GNU and UNIX Commands [30] \item (2.4) Devices, Linux Filesystems \& FHS [21] \item (2.6) Boot, Initialisation, Shutdown, Runlevels [6] \item (1.8) Documentation [8] \item (2.11) Administrative Tasks [24] \end{itemize} \end{minipage} \vfill \end{slide} %------------------------------------------------------------------------------ %============================================================================== %============================================================================== %============================================================================== \begin{slide}\setcounter{slidesection}{102} \slideheading{(1.3) GNU and UNIX Commands [30]} \begin{enumerate} \item Work on the command line [4] \item Process text streams using filters [7] \item Perform basic file management [2] \item Use streams, pipes, and redirects [3] \item Create, monitor, and kill processes [7] \item Modify process execution priorities [2] \item Search text files using regular expressions [3] \item Perform basic file editing operations using vi [2] \end{enumerate} \vfill \end{slide} %------------------------------------------------------------------------------ %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Work on the command line [4]} \slidesubsubheading{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. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Key files, terms and utilities} \scriptsize \begin{itemize} \item . \item bash \item echo \item env \item exec \item export \item man \item pwd \item set \item unset \item \~{}.bash\_history \item \~{}/.profile \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{test} this is the beginning \begin{overlay}{1} blah \end{overlay} \begin{overlay}{2} \rnode{a}{blah blah} \end{overlay} \begin{overlay}{3} blah \end{overlay} \begin{overlay}{2} note... \rnode{b}{thing} \end{overlay} \nccurve[linecolor=red,angleA=270,angleB=0]{<->}{a}{b}% \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Shell Prompt} The command prompt is held in the shell variable \textsf{\$PS1} (\textsf{P}rompt \textsf{S}tring \textsf{1}). \begin{itemize} \begin{overlay}{1}{% \item Simple User prompt: \begin{alltt} \$ echo \$PS1 \(\hookleftarrow\) \verb+\$+ \$ \end{alltt} }\end{overlay} \begin{overlay}{2}{% \item Fancy user prompt: \begin{alltt} \$ export \verb+PS1="[\u@\\h:\W]\$ "+ \(\hookleftarrow\) [geoffrey@marsbar:geoffrey]\$ \end{alltt} }\end{overlay} \begin{overlay}{3}{% \item Fancy prompt for the superuser:\\ {\textcolor{red}{\texttt{[root@marsbar root]\#}}} echo \$PS1 \(\hookleftarrow\) \begin{verbatim} \[\033[1;31m\][\u@\h \W]# \[\033[0m\] \end{verbatim} {\textcolor{red}{\texttt{[root@marsbar root]\#}}} }\end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Command Execution} In order for \textsf{bash} to execute a command entered at the prompt, the command must be one of the following: \begin{itemize} \begin{overlay}{1} \item An alias: \texttt{\$ alias ll='ls -l' \(\hookleftarrow\)} \end{overlay} \begin{overlay}{2} \item A \textsf{bash} builtin: e.g. \texttt{\$ cd \(\hookleftarrow\)} \end{overlay} \begin{overlay}{3} \item An executable in a directory that is listed in the \texttt{\$PATH} variable: \begin{alltt} \$ which ls \(\hookleftarrow\) /bin/ls \end{alltt} \end{overlay} \begin{overlay}{4} \item Explicitly defined by absolute or relative path \begin{alltt} \$ \~{}/my\_scripts/my.sh \(\hookleftarrow\) hi \$ cd \~{}/my\_scripts \(\hookleftarrow\) \$ ./my.sh \(\hookleftarrow\) \end{alltt} \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{PATH}} The \texttt{PATH} environmental variable holds a list of directories. These directories hold executable programs. \begin{itemize} \begin{overlay}{1} \item View the \texttt{PATH} variable: \begin{alltt} \$ echo \$PATH /usr/kerberos/bin:/bin:/usr/bin:/usr/bin/X11:\verb+\+ /usr/local/bin:/usr/bin:/usr/X11R6/bin:/home/\verb+\+ geoffrey/bin:/home/geoffrey/bin \end{alltt} \end{overlay} \begin{overlay}{2} \item General user \texttt{PATH} is configured in \texttt{/etc/profile} \end{overlay} \begin{overlay}{3} \item \texttt{PATH} may be modified in \texttt{\~{}/.bash\_profile} \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Command history} \begin{itemize} \begin{overlay}{1} \item Previously used commands accessed through the use of the arrow keys \end{overlay} \begin{overlay}{2} \item The size of the history file is determined by \texttt{HISTSIZE} \end{overlay} \begin{overlay}{3} \item The command \texttt{history} lists the last \texttt{HISTSIZE} commands \begin{alltt} \$ history ... 1007 xhost + 1008 history \$ \end{alltt} \end{overlay} \begin{overlay}{4} \item The command \texttt{fc} opens the command in the default editor for editing \begin{alltt} \$ fc 1007 xhost + ~ ~ \end{alltt} \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Process text streams using filters [7]} \slidesubsubheading{Objective} Candidate should be able to apply filters to text streams. Tasks include sending text files and output streams through text utility filters to modify the output, and using standard UNIX commands found in the GNU textutils package. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide}{} \Slidecontents \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Perform basic file management [2]} \slidesubsubheading{Objective} Candidate should be able to use the basic UNIX commands to copy, move, and remove files and directories. Tasks include advanced file management operations such as copying multiple files recursively, removing directories recursively, and moving files that meet a wildcard pattern. This includes using simple and advanced wildcard specifications to refer to files, as well as using find to locate and act on files based on type, size, or time. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Use streams, pipes, and redirects [3]} \slidesubsubheading{Objective} Candidate should be able to redirect streams and connect them in order to efficiently process textual data. Tasks include redirecting standard input, standard output, and standard error, piping the output of one command to the input of another command, using the output of one command as arguments to another command and sending output to both stdout and a file. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Create, monitor, and kill processes [7]} \slidesubsubheading{Objective} Candidate should be able to manage processes. This includes knowing how to run jobs in the foreground and background, bring a job from the background to the foreground and vice versa, start a process that will run without being connected to a terminal and signal a program to continue running after logout. Tasks also include monitoring active processes, selecting and sorting processes for display, sending signals to processes, killing processes and identifying and killing X applications that did not terminate after the X session closed. \begin{overlay}{1} \slidesubsubheading{Key files, terms and utilities} \begin{minipage}[t]{40mm} \begin{itemize} \item \texttt{ps} \item \texttt{pstree} \item \texttt{top} \item \texttt{kill} \item \texttt{nohup} \end{itemize} \end{minipage} % \begin{minipage}[t]{30mm} \begin{itemize} \item \texttt{jobs} \item \texttt{bg} \item \texttt{fg} \item \texttt{\&} \item \texttt{\textasciicircum Z} \end{itemize} \end{minipage} \end{overlay} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Processes} \begin{itemize} \item A process is an executable loaded in memory. \item Linux is a multitasking operating system and so runs many processes concurrently. \begin{overlay}{1} \item INIT (PID 1) is the mother of all processes. \end{overlay} \begin{overlay}{2} \item Programs, daemons, shells and commands are all processes. \end{overlay} \begin{overlay}{3} \item The kernel automatically manages processes. \end{overlay} \begin{overlay}{4} \item Normally processes live, execute and die without intervention from users. \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Process Attributes and Concepts} The kernel starts the first process: \texttt{init} which has \textsf{PID 1} \begin{description} \begin{overlay}{1} \item[Lifetime:] Each process starts when it's command is executed, and lives till it dies or is killed. \end{overlay} \begin{overlay}{2} \item[Process ID (PID):] Every process has a unique number assigned to it when it is started. \end{overlay} \begin{overlay}{3} \item[User ID and Group ID:] Processes have the privileges associated with the user / group who started them. \end{overlay} \begin{overlay}{4} \item[Parent processes (PPID):] Shell processes are descendants of \textsf{init} and commands run from them are child processes. \end{overlay} \begin{overlay}{5} \item[Environment:] Each process inherits a set of \textit{environmental variables} from it's parent process. \end{overlay} \begin{overlay}{6} \item[Current Working Directory:] Each process starts with a default directory. \end{overlay} \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Process Monitoring} Processes have to be monitored so as to check their health and use of system resources. \begin{itemize} \begin{overlay}{1} \item ps \small \begin{alltt} \$ ps aux |grep ssh root 866 0.0 0.3 2676 1268 ? S 07:56 0:00 /usr/sbin/sshd \end{alltt} \end{overlay} \begin{overlay}{2} \item pstree \small \begin{alltt} \$ pstree init-+-alarmd |-apmd |-kdeinit-+-autorun | |-kdeinit---emacs \end{alltt} \end{overlay} \begin{overlay}{3} \item top \small \begin{alltt} \$ top PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND 1792 geoffrey 11 0 8796 8796 7932 S 0.3 2.2 0:01 kdeinit 1590 root 14 0 57512 13M 2572 R 0.1 3.6 0:41 X 2857 geoffrey 14 0 1056 1056 836 R 0.1 0.2 0:01 top \end{alltt} \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Process Management} Normally the kernel automatically manages processes. However sometimes processes have to be started, stopped, restarted and killed. \begin{itemize} \begin{overlay}{1} \item Starting a process: \small \begin{alltt} \# /usr/sbin/httpd ps aux |grep httpd root 2987 0.0 0.4 4512 1584 ? /usr/sbin/httpd apache 3003 0.0 0.4 4656 1672 ? /usr/sbin/httpd \end{alltt} \end{overlay} \begin{overlay}{2} \item Occasionally processes die and have to be restarted. \end{overlay} \begin{overlay}{3} \item Processes may go beserk and have to be killed.\small \begin{alltt} \# kill -9 1234 \end{alltt} \end{overlay} \begin{overlay}{4} \item After configuration changes processes may have to be restarted so as to re-read their configuration files.\small \begin{alltt} \# service xinetd restart Stopping xinetd: [ OK ] Starting xinetd: [ OK ] \end{alltt} \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{What is multitasking?} Multitasking is used to describe the situation where one processor (CPU) is used to perform multiple tasks concurrently. \begin{itemize} \item Only one task or program is executing instructions on the CPU. \item The CPU must be regularly switched between each program and others. \item This process is known as a \textit{task switch}. \item At each \textit{task switch} the Linux kernel must save the \textit{context} of the CPU. \item The operating system uses the saved context when it switches back to the task the next time it gets some CPU time scheduled to it. \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{Task Scheduling} The total number of slices, when, how often and for how long the CPU is switched is determined by the multitasking algorithm and is handled by a software component within the kernel know as the \textit{task scheduler}. There are three basic types of task scheduling: \begin{description} \item[Nonpreemptive:] A task must relinquish the CPU before a task switch occurs. \item[Preemptive:] The kernel takes away the CPU from a task without notice. \item[Realtime:] Tasks are prioritised. High priority tasks must complete before a task switch. \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{What is a Process?} The term process is a fundamental abstraction: Two of the more traditional definitions of a process are: \begin{quote} ``A program in execution.'' \end{quote} \begin{quote} ``A single program running in its own virtual address space'' \end{quote} In practice, a process is simply an executable that has been loaded into memory and is either running or ready to run on the system. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{Process types} Processes under Linux fall into three basic categories: \begin{description} \item[Interactive Process:] An interactive process is a process initiated from (and controlled by) a shell. Interactive processes may be in foreground or background. \\(Example: \texttt{ls, ls \&}) \item[Batch Process:] A batch process is a process that is not associated with a terminal but is submitted to a queue to be executed sequentially. \\(Example \texttt{slocate} started by \texttt{cron}) \item[Daemon Process:] A daemon process is a process that runs in the background until it's required. This kind of processes is usually initiated when Linux boots. \\(Example: \texttt{inetd}, \texttt{lpd}) \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{Elements associated with a process} For each process running on the system, the kernel needs to keep a list of resources used by that process. Some of these resources include: \begin{itemize} \item tty association (\texttt{tty\_struct}) \item file system (eg current directory \& open files) (\texttt{fs\_struct}, \texttt{files\_struct}) \item memory allocation \texttt{(mm\_struct}) \item Signals received (\texttt{signal\_struct}) \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{Process States} At any given point in time, a process is in one of 5 states: \begin{description} \item[TASK\_RUNNING:] The process is either executing on the CPU or waiting to be executed. \item[TASK\_INTERRUPTIBLE:] The process is sleeping until something becomes true. Raising a hardware interrupt, waiting for a system resource etc are examples of a condition that might wake the process up. If a signal is received by the process (eg KILL -HUP) the process will also be woken up. \item[TASK\_UNINTERRUPTIBLE:] Like the previous state except that delivering a signal will not wake the process up. \item[TASK\_STOPPED:] Process execution has stopped. A process enters this state after receiving a SIGSTOP signal. A debugger may use this to step through a program. \item[TASK\_ZOMBIE:] Process execution has stopped but the kernel has not yet ?cleaned up? the resources allocated to the process. \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{The Process Family Tree} Every process (with the sole exception of the kernel), must be created by another process. The terms \textit{parent}, \textit{child} and \textit{sibling} (or sometimes \textit{father}, \textit{son} and \textit{brother} in a patriarchal sense) are used to describe the relationships between processes. As an example consider the following line executed from the bash prompt: \begin{alltt} [andy@Node4] andy]\$ ls \& df -h \& \end{alltt} The following relationships are true: \begin{itemize} \item The \texttt{ls} and \texttt{df} processes are both siblings to each other. \item The \texttt{bash} process (ie the shell) is the parent to both \texttt{ls} and \texttt{df}. \item The \texttt{ls} process has \texttt{bash} as its parent. \item The \texttt{df} process has \texttt{bash} as its parent. \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{The Kernel is at the Top of the Family Tree} \begin{itemize} \item When linux boots, the first thing it does is load the kernel into memory and start executing itself. \item One of the first things it does once execution starts, is to spawn a process called init, which in turn spawns other processes. \item In this sense, the kernel is at the top of the family tree, with only one child process called init. \item Init in turn has many children and probably many grandchildren. \end{itemize} \begin{alltt} Kernel --> Init --> all other processes --> even more processes --> \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{Process IDs} In order for the kernel to keep track of all processes and their descendants, a process ID is assigned to every process running on the system. Process IDs are just numbers and run from 0 to 32767. The number 32767 is the largest signed integer available with a sixteen bit word size and is used to maintain backward compatibility with 16 bit architectures. There are two PIDs (process IDs) that are always the same: \begin{itemize} \item kernel PID is always 0 \item init PID is always 1 \end{itemize} Each time a new process is created, a new PID is allocated and is equal to the last PID issued plus one. Once the last PID is reached, the PID wraps back around to zero and the next available PID is used (note that 0 and 1 will never be available). This scheme is a little like the assignment of telephone numbers: When a telephone service is disconnected, rather than just assigning the old telephone number to a new subscriber, the old number remains out of use until all other numbers have been used up. This saves ``wrong numbers'' to the new subscriber from callers who have not yet realised that the old number is no longer connected to the person they were trying to reach. In a similar vein, the kernel does this to minimise ``wrong numbers'' from other processes who have not yet worked out that their intended process no longer exists. This is especially true for Interprocess Communication (IPC) which uses the PID to identify a target process. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{Displaying Process Information} There are two utilities used to display the state of running processes: \begin{itemize} \item \texttt{ps} \item \texttt{top} \end{itemize} The ps command is used to display a ``snapshot'' of all processes running on the system at the time the \texttt{ps} command was executed. The \texttt{top} command is used to display a real-time display of all processes running on the system. Top can also be used in interactive mode to \texttt{kill} or \texttt{renice} (change priority) of a process. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{Process Monitoring---\texttt{ps}} The \texttt{ps} command has a huge number of switches. The switches can be subdivided into two main groups: \begin{itemize} \item Process selection (which processes to display) \item Output control (how and what output should be displayed) \end{itemize} \begin{quote} \textit{usage:} \texttt{ps [options]} \end{quote} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{\texttt{ps} options} The switches that need to be known for the purposes of LPIC are as follows: \begin{description} \item[{\bf\texttt{a}}] Display processes for all users \item[{\bf\texttt{txx}}] Display processes within controlling terminal \texttt{txx} \item[{\bf\texttt{u}}] Display user information for the process \item[{\bf\texttt{l}}] Display in long format with detailed information \item[{\bf\texttt{s}}] Display signal information \item[{\bf\texttt{m}}] Display memory information \item[{\bf\texttt{x}}] Display processes without a controlling terminal \item[{\bf\texttt{S}}] Display CPU time and page faults of child processes \item[{\bf\texttt{-C cmd}}] Search for instances of command \texttt{cmd.} \item[{\bf\texttt{-f}}] Forest mode shows process family trees. \item[{\bf\texttt{-w}}] Wide format \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide}%ghr \slidesubsubheading{\texttt{ps} options} \scriptsize \begin{alltt} \$ ps ? ERROR: Garbage option. ********* simple selection ********* ********* selection by list ********* -A all processes -C by command name -N negate selection -G by real group ID (supports names) -a all w/ tty except session leaders -U by real user ID (supports names) -d all except session leaders -g by session leader OR by group name -e all processes -p by process ID T all processes on this terminal -s processes in the sessions given a all w/ tty, including other users -t by tty g all, even group leaders! -u by effective user ID (supports names) r only running processes U processes for specified users x processes w/o controlling ttys t by tty *********** output format ********** *********** long options *********** -o,o user-defined -f full --Group --User --pid --cols -j,j job control s signal --group --user --sid --rows -O,O preloaded -o v virtual memory --cumulative --format --deselect -l,l long u user-oriented --sort --tty --forest --version X registers --heading --no-heading ********* misc options ********* -V,V show version L list format codes f ASCII art forest -m,m show threads S children in sum -y change -l format -n,N set namelist file c true command name n numeric WCHAN,UID -w,w wide output e show environment -H process hierarchy \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{\texttt{ps} field names \& their meanings} \begin{description} \item[{\bf\texttt{USER}}] The user who started the process \item[{\bf\texttt{PID}}] The process ID \item[{\bf\texttt{\%CPU}}] Shows the cputime / realtime percentage. \item[{\bf\texttt{\%MEM}}] The fraction of RSS divided by the total size of RAM \item[{\bf\texttt{VSZ}}] Size of virtual memory used by the process \item[{\bf\texttt{RSS}}] Resident set size (Data \& Text segments only) in Kb \item[{\bf\texttt{TTY}}] The TTY associated with this process \item[{\bf\texttt{STAT}}] The current status (DRSTZW bigfile.wc & \(\hookleftarrow\) [1] 1654 \$ \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Alex J \slidesubsubheading{The \texttt{jobs} command} \begin{description} \item [\texttt{\$ jobs \(\hookleftarrow\)}]:\\ Lists all commands stopped, or running in the background. \item [Options]:\\ \texttt{-l} List pid \item [Example]:\\ Start some processes in the background and suspend a foreground process. \begin{alltt} \$ jobs \(\hookleftarrow\) [1]+ Stopped less job_control.txt [2]- Running xeyes & \$ \end{alltt} \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Alex J \slidesubsubheading{The \texttt{fg} command} \begin{description} \item [\texttt{\$ fg \(\hookleftarrow\)}]:\\ Shell built-in used to force a suspended or background process to continue running in the foreground. \item [Example]:\\ Use the 'jobs' command to find job id. \begin{alltt} \$ jobs \(\hookleftarrow\) [1]+ Stopped less job_control.txt [2]- Running xeyes & \$ \end{alltt} Use \texttt{fg} to bring xeyes to foreground. \begin{alltt} \$ fg 2 \(\hookleftarrow\) xeyes \end{alltt} A \texttt{\%} used with the job id is equivalent to \texttt{fg 2}. \begin{alltt} \$ \%2 \(\hookleftarrow\) xeyes \end{alltt} \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Alex J \slidesubsubheading{The \texttt{fg} command} A job can also be referred to by a string that uniquely identifies the beginning of the command line used to start a job. A '\%' can also be used with a unique string. \begin{alltt} \$ fg x \(\hookleftarrow\) xeyes \end{alltt} or \begin{alltt} \$ \%x \(\hookleftarrow\) xeyes \end{alltt} If \texttt{fg} is issued without any argument, the job with the '+' in the job list is brought to the foreground. \begin{alltt} \$ fg \(\hookleftarrow\) xeyes \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{The \texttt{bg} command} \begin{description} \item [\texttt{\$ bg \(\hookleftarrow\)}]:\\ Used to force a suspended process to continue running in the background. \item [Example]:\\ Use the 'jobs' command to find job id. \begin{alltt} \$ jobs \(\hookleftarrow\) [1]- Stopped find -name myfile >myfile.found (wd: /) [2]+ Stopped less job_control.txt [3] Running xeyes & \$ \end{alltt} \end{description} Job 1 shows the 'find' command was started in the foreground and then suspended.To start 'find' in the background, use the 'bg' command or '\%'. \begin{description} \item [Example]: \begin{alltt} \$ bg 1 \(\hookleftarrow\) {\rm or} \$ bg f \(\hookleftarrow\) {\rm or} \$ \%1 \& \(\hookleftarrow\) {\rm or} \$ \%f \& \(\hookleftarrow\) \end{alltt} \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Modify process execution priorities [2]} \slidesubsubheading{Objective} Candidate should be able to manage process execution priorities. Tasks include running a program with higher or lower priority, determining the priority of a process and changing the priority of a running process. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Search text files using regular expressions [3]} \slidesubsubheading{Objective} The candidate should be able to manipulate files and text data using regular expressions. This objective includes creating simple regular expressions containing several notational elements. It also includes using regular expression tools to perform searches through a filesystem or file content. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Perform basic file editing operations using vi [2]} \slidesubsubheading{Objective} Candidate must be able to edit text files using vi. This objective includes vi navigation, basic vi nodes, inserting, editing, deleting, copying, and finding text. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide}{} \Slidecontents \end{slide} %--------------------------------------- %============================================================================== %============================================================================== %============================================================================== \begin{slide}\setcounter{slidesection}{103} \slideheading{(2.4) Devices, Linux Filesystems \& FHS [21]} \begin{enumerate} \item Create partitions and filesystems [3] \item Maintain the integrity of filesystems [5] \item Control mounting and unmounting filesystems [3] \item Managing disk quota [1] \item Use file permissions to control access to files [3] \item Manage file ownership [2] \item Create and change hard and symbolic links [2] \item Find system files and place files in the correct location [2] \end{enumerate} \vfill \end{slide} %------------------------------------------------------------------------------ %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Create partitions and filesystems [3]} \slidesubsubheading{Objective} Candidates should be able to configure disk partitions and then create filesystems on media such as hard disks. This objective includes using various mkfs commands to set up partitions to various filesystems, including ext2, ext3, reiserfs, vfat, and xfs. \slidesubsubheading{Key files, terms, and utilities include:} \begin{alltt} fdisk mkfs \end{alltt} \slidesubsubheading{Resources} TBA \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{devices---major and minor numbers} \begin{itemize} \begin{overlay}{1} \item All devices have a major and a minor number, \\e.g. floppy disks have the major number of 2 \\and the first floppy disk has a minor number of 0. \end{overlay} \begin{overlay}{2} \item All devices are represented by \textsf{device nodes} in \texttt{/dev/} \end{overlay} \begin{overlay}{3} \item Device nodes may be made thus: \begin{alltt} # mknod -b /dev/fd0 2 0 \(\hookleftarrow\) \end{alltt} \end{overlay} \begin{overlay}{4} \item Should you inadvertently loose your device nodes a new set can be generated by running the utility \texttt{/dev/MAKEDEV} \end{overlay} \begin{overlay}{5} \item Access to devices may be modified by changing the permissions to the device node. However, there is usually a better way. \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{block devices} Block devices are generally random access rotating memory but may use other technologies. \begin{itemize} \item \textsf{ide hard disk}---\texttt{/dev/hdc} \item \textsf{scsi hard disk}---\texttt{/dev/sdb} \item \textsf{scsi cdrom}---\texttt{/dev/sr2} \item \textsf{ide zip disk}---\texttt{/dev/hdd} \item \textsf{floppy disk}---\texttt{/dev/fd5} \item \textsf{ide cdrom disk}---\texttt{/dev/hdc} \item \textsf{scsi cd-rw disk}---\texttt{/dev/sr4} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{disk partitions} On \textsf{i386} systems disks may be sliced up into to 15 partitions. \begin{itemize} \begin{overlay}{1} \item The disk must have at least 1 \textsf{primary} partition. \begin{alltt} /dev/hda1 \end{alltt} \end{overlay} \begin{overlay}{2} \item There may be up to 4 \textsf{primary} partitions. \begin{alltt} /dev/hda1 (primary) /dev/hda2 (primary) /dev/hda3 (primary) /dev/hda4 (primary) \end{alltt} \end{overlay} \begin{overlay}{3} \item One of the primary partitions may be made into an \textsf{extended} partition. \end{overlay} \begin{overlay}{4} \item The one \textsf{extended} partition must hold between 1 and 12 \textsf{logical} partitions. \begin{alltt} /dev/hda1 (primary) /dev/hda2 (extended) /dev/hda5 (logical) /dev/hda6 (logical) \end{alltt} \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{fdisk} disk partitioning tool} \begin{alltt} \# fdisk \(\hookleftarrow\) Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk) or: fdisk /dev/sdc (for the third SCSI disk) or: fdisk /dev/eda (for the first PS/2 ESDI drive) or: fdisk /dev/rd/c0d0 (for RAID devices) or: fdisk /dev/ida/c0d0 (for RAID devices) ... \# \end{alltt} \begin{overlay}{1} {\tt \textbf{-b sectorsize}} old kernels only \\{\tt \textbf{-l}} list the partition table only \\{\tt \textbf{-u}} sectors not cylinders \\{\tt \textbf{-s}} print size in blocks \end{overlay} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{fdisk}} \begin{alltt} \# fdisk /dev/hda \(\hookleftarrow\) The number of cylinders for this disk is set to 3648. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): _ \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{fdisk} menu} \small \begin{alltt} Command (m for help): m \(\hookleftarrow\) Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag \underline{d delete a partition} \underline{l list known partition types} \underline{m print this menu} \underline{n add a new partition} o create a new empty DOS partition table \underline{p print the partition table} \underline{q quit without saving changes} s create a new empty Sun disklabel \underline{t change a partition's system id} u change display/entry units v verify the partition table \underline{w write table to disk and exit} x extra functionality (experts only) \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{fdisk} \textbf{p}rint the partition table} \begin{alltt} Command (m for help): p \(\hookleftarrow\) Disk /dev/hda: 255 heads, 63 sectors, 3648 cylinders Units = cylinders of 16065 * 512 bytes Device Boot Start End Blocks Id System /dev/hda1 * 1 768 6168928+ c Win95 FAT32 (LBA) /dev/hda2 769 3648 23133600 5 Extended /dev/hda5 769 780 96358+ 83 Linux /dev/hda6 781 904 995998+ 82 Linux swap /dev/hda7 905 2363 11719386 83 Linux /dev/hda8 2364 2485 979933+ 83 Linux Command (m for help): _ \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{fdisk} exercise on a floppy} {\Large\textsf{Warning it makes no sense to use \texttt{fdisk} on a floppy}.} \begin{alltt} \# fdisk /dev/fd0 Command (m for help): p Disk /dev/fd0: 2 heads, 18 sectors, 80 cylinders Units = cylinders of 36 * 512 bytes Device Boot Start End Blocks Id System /dev/fd0p1 1 20 351 1 FAT12 /dev/fd0p2 21 25 90 83 Linux /dev/fd0p3 26 80 990 5 Extended /dev/fd0p5 26 30 81 83 Linux /dev/fd0p6 31 70 711 83 Linux /dev/fd0p7 71 80 171 83 Linux \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{using \texttt{sfdisk} on a floppy} \small \begin{alltt} \# sfdisk -f /dev/fd0 Disk /dev/fd0: 80 cylinders, 2 heads, 18 sectors/track Old situation: Units = cylinders of 18432 bytes, blocks of 1024 bytes,counting from 0 Device Boot Start End #cyls #blocks Id System /dev/fd0p1 0+ 19 20- 351 1 FAT12 /dev/fd0p2 20 24 5 90 83 Linux /dev/fd0p3 25 79 55 990 5 Extended /dev/fd0p4 0 - 0 0 0 Empty /dev/fd0p5 25+ 29 5- 81 83 Linux /dev/fd0p6 30+ 69 40- 711 83 Linux /dev/fd0p7 70+ 79 10- 171 83 Linux Input in the following format; absent fields get a default value. Usually you only need to specify , (and perhaps ). /dev/fd0p1 : \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{using \texttt{sfdisk} on hda} \small \begin{alltt} \# sfdisk -f /dev/hda \(\hookleftarrow\) Disk /dev/hda: 3648 cylinders, 255 heads, 63 sectors/track Old situation: Units = cylinders 8225280 bytes, blocks of 1024 bytes, counting from 0 Device Boot Start End #cyls #blocks Id System /dev/hda1 * 0+ 767 768- 6168928+ c Win95 FAT32 (LBA) /dev/hda2 768 3647 2880 23133600 5 Extended /dev/hda3 0 - 0 0 0 Empty /dev/hda4 0 - 0 0 0 Empty /dev/hda5 768+ 779 12- 96358+ 83 Linux /dev/hda6 780+ 903 124- 995998+ 82 Linux swap /dev/hda7 904+ 2362 1459- 11719386 83 Linux /dev/hda8 2363+ 2484 122- 979933+ 83 Linux Input in the following format; absent fields get a default value. Usually you only need to specify , (and perhaps ). /dev/hda1 : _ \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\textsf{GNU parted}---partition table manipulator} \small \begin{alltt} \# parted /dev/hda \(\hookleftarrow\) (parted) help \(\hookleftarrow\) check MINOR do a simple check on the filesystem cp [FROM-DEVICE] FROM-MINOR TO-MINOR copy fs to another partition help [COMMAND] prints general help, help on COMMAND mklabel LABEL-TYPE create a new disklabel (part. table) mkfs MINOR FS-TYPE make a fs FS-TYPE on partititon MINOR mkpart PART-TYPE [FS-TYPE] START END make a partition mkpartfs PART-TYPE FS-TYPE START END make a partition with a fs move MINOR START [END] move partition MINOR name MINOR NAME name partition MINOR NAME print display the partition table quit exit program resize MINOR START END resize filesystem on partition MINOR rm MINOR delete partition MINOR select DEVICE choose the device to edit set MINOR FLAG STATE change a flag on partition MINOR (parted) \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\textsf{GNU parted}---partition table manipulator} This utility has similar uses as the commercial utility "Partition Magic". It can resize partitions. \small \begin{alltt} (parted) p Disk geometry for /dev/hda: 0.000-28615.781 megabytes Disk label type: msdos Minor Start End Type Filesystem Flags 1 0.031 6024.375 primary FAT boot, lba 2 6024.375 28615.781 extended 5 6024.406 6118.505 logical ext2 6 6118.537 7091.191 logical linux-swap 7 7091.222 18535.935 logical ext2 8 18535.966 19492.932 logical (parted) \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{fips.exe}---resize FAT partitions} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{File System Types} \small \begin{description} \item[ext2] Linux standard file system (\textsf{type 83}) \item[ext3] New journaling file system \item[reiserfs] Journaling file system \item[qnx4] qnx4 file system \item[minix] Used by Minux and where space is at a premium \item[iso9660] Standard file system on CDROMs \item[msdos] Microsoft FAT16 file system \item[vfat] Microsoft FAT32 file system \item[ntfs] Microsoft NT file system \item[hfs] Apple file system \item[nfs] Network File System \item[proc] Linux process file system \item[swap] Linux swap file system (\textsf{type 82}) \item[smbfs] Samba \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{mkfs}---make filesystem} One the a partition is made and has been given a type it must \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{mkswap}} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Maintain the integrity of filesystems [5]} \slidesubsubheading{Objective} Candidates should be able to verify the integrity of filesystems, monitor free space and inodes, and repair simple filesystem problems. This objective includes the commands required to maintain a standard filesystem, as well as the extra data associated with a journaling filesystem. \slidesubsubheading{Key files, terms, and utilities include:} \begin{alltt} du df fsck e2fsck mke2fs debugfs dumpe2fs tune2fs \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{du}---disk usage} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{df}---} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{fsck}---check and repair a Linux file system} \begin{itemize} \item fsck is used to check and optionally repair a one or more Linux file systems. \item filesys can be a device name (e.g. /dev/hdc1, /dev/sdb2), a mount point (e.g. /, /usr, /home), or an ext2 label or UUID specifier (e.g. UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). \item The fsck program will try to run filesystems on different physical disk drives in parallel to reduce total amount time to check all of the filesystems. \item Options: \begin{itemize} \item \textsf{-A} Walk through the /etc/fstab file and try to check all file systems in one run. This option is typically used from the /etc/rc system initialization file, instead of multiple commands for checking a single file system. \item \textsf{-a} Automatically repair the file system without any questions (use this option with caution). \end{itemize} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{e2fsck}---check a Linux second extended file system} e2fsck is used to check a Linux second extended file system (e2fs). E2fsck also supports ext2 filesystems containing a journal, which are also sometimes known as ext3 filesystems. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{mke2fs}---create a Linux second extended file system} mke2fs is used to create a Linux second extended file system on a device (usually a disk partition). device is the special file corresponding to the device (e.g /dev/hdXX). blocks-count is the number of blocks on the device. If omitted, mke2fs automagically figures the file system size. \begin{verbatim} mke2fs [ -c | -l filename ] [ -b block-size ] [ -f fragment- size ] [ -i bytes-per-inode ] [ -j ] [ -J journal- options ] [ -N number-of-inodes ] [ -n ] [ -m reserved- blocks-percentage ] [ -o creator-os ] [ -O feature[,...] ] [ -q ] [ -r fs-revision-level ] [ -R raid-options ] [ -v ] [ -F ] [ -L volume-label ] [ -M last-mounted-directory ] [ -S ] [ -T filesystem-type ] [ -V ] device [ blocks-count] \end{verbatim} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{debugfs}---ext2 file system debugger} The debugfs program is a file system debugger. It can be used to examine and change the state of an ext2 file system. debugfs is an interactive debugger. It understands a number of commands. \begin{description} \item[cat filespec] Dump the contents of the inode filespec to stdout. \item[cd filespec] Change the current working directory to filespec. \item[chroot filespec] Change the root directory to be the directory file spec. \item[close] Close the currently open file system. \item ? \item ? \item ? \item ? \item ? \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{dumpe2fs}---dump filesystem information} dumpe2fs prints the super block and blocks group information for the filesystem present on device. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{tune2fs}---adjust tunable filesystem parameters on ext2 fs} tune2fs adjusts tunable filesystem parameters on a Linux second extended filesystem. \begin{verbatim} tune2fs [ -l ] [ -c max-mount-counts ] [ -e errors-behavior ] [ -i interval-between-checks ] [ -j ] [ -J journal options ] [ -m reserved-blocks-percentage ] [ -r reserved blocks-count ] [ -s sparse-super-flag ] [ -u user ] [ -g group ] [ -C mount-count ] [ -L volume-name ] [ -M last mounted-directory ] [ -O [^]feature[,...] ] [ -U UUID ] device \end{verbatim} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Control mounting and unmounting filesystems [3]} \slidesubsubheading{Objective} Candidates should be able to configure the mounting of a filesystem. This objective includes the ability to manually mount and unmount filesystems, configure filesystem mounting on bootup, and configure user mountable removeable filesystems such as tape drives, floppies, and CDs. \slidesubsubheading{Key files, terms, and utilities} \begin{alltt} /etc/fstab mount umount \end{alltt} \slidesubsubheading{Resources of Interest} Appropriate man pages. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Linux file system} Unlike MSDOS based operating systems that use named volumes with separate file systems (C: drive, A: drive, etc.) Linux and other unicies have a unified filesystem with volumes ``grafted'' in to a single tree at various \textsf{mount} points. The mount points are arbitrary. Typical mount points for removable media are as follows: \begin{itemize} \item Floppy disk: device \textsf{/dev/fd0} mounted at \texttt{/mnt/floppy} \item ZIP drive: mounted at \texttt{/ZIP} \item CDROM disk: device \texttt{/dev/hdc} mounted at \texttt{/mnt/cdrom} \item CD Writer: device \texttt{/dev/sd2} mounted at \texttt{/burner} \item Network drive: mounted at \texttt{/mnt/nfs/database} \item NT Server network drive: \texttt{/mnt/samba-vol} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{First Level Directories} \scriptsize \begin{alltt} \$ tree -L 1 \(\hookleftarrow\) / |-- backups |-- bin |-- boot |-- boot~ |-- dev |-- dvd |-- etc |-- home |-- incomming -> /usr/local/incomming/ |-- lib |-- lost+found |-- mnt |--floppy `--cdrom |-- proc |-- root |-- sbin |-- tmp |-- usr |-- var `-- zip \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{The \texttt{mount} Command} \large \begin{alltt} \# mount -t type /dev/device_node /mount_point \(\hookleftarrow\) \end{alltt} \normalsize \begin{overlay}{1} \begin{description} \item[type] The type of file system e.g. \textsf{vfat} or \textsf{ext2} \item[device\_node] The device node for the appropriate block device e.g. \texttt{/dev/fd0} \item[mount\_point] The existing directory where the file system will be come accessible. e.g. \texttt{/mnt/floppy} \end{description} \end{overlay} \begin{overlay}{2} \slidesubsubheading{\texttt{mount} example} \begin{alltt} \# touch /flb/im_gona_be_hidden \(\hookleftarrow\) \# ls /flb \(\hookleftarrow\) im_gona_be_hidden \# mount -t msdos /dev/fd1 /flb \(\hookleftarrow\) mount: block device /dev/fd1 is write-protected, read-only \# ls /flb \(\hookleftarrow\) ecp5-1.c ecp5-4.c ecp5-6.c \# \end{alltt} \end{overlay} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Filesystem Types} \begin{alltt} \# mount -t type ... \end{alltt} \begin{description} \item[ext2] Linux standard file system \item[ext3] New journaling file system \item[reiserfs] Journaling file system \item[qnx4] qnx I presume \item[minix] Used by Minux and where space is a premium \item[iso9660] Standard file system on CDROMs \item[msdos] Microsoft FAT16 file system \item[vfat] Microsoft FAT32 file system \item[ntfs] Microsoft NT file system \item[hfs] Apple file system \item[nfs] Network File System \item[smbfs] Samba \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{configuration: \texttt{/etc/fstab}} The file \texttt{/etc/fstab} is a table of static mount information. The mount command references this table. Edit this file to reflect your system. \small \begin{alltt} \$ cat /etc/fstab \(\hookleftarrow\) # /dev/sda1 / ext2 defaults,errors=remount-ro 0 1 /dev/sda2 /tmp ext2 rw 0 2 /dev/sda3 /var ext2 rw 0 2 /dev/sda4 none swap sw 0 0 /dev/sr5 /writer iso9660 defaults,ro,user,noauto 0 0 /dev/hdb /dvd iso9660 defaults,ro,user,noauto 0 0 /dev/fd0 /mnt/floppy auto defaults,user,noauto 0 0 \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Abreviated \texttt{mount} commands} Using entries in the \texttt{/etc/fstab} configuration file mount commands may be abbreviated: \begin{itemize} \item Mount a floppy \begin{alltt} \$ mount /mnt/floppy \(\hookleftarrow\) \end{alltt} \item Mount the DVD: \begin{alltt} \$ mount /dvd \(\hookleftarrow\) \end{alltt} \end{itemize} \begin{overlay}{1} \slidesubsubheading{Unmounting filesystems \texttt{umount}} \begin{itemize} \item Unmount a floppy \begin{alltt} \$ umount /mnt/floppy \(\hookleftarrow\) \end{alltt} \item Unmount the DVD: \begin{alltt} \$ umount /dvd \(\hookleftarrow\) \end{alltt} \end{itemize} \end{overlay} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{/etc/mtab}} \texttt{/etc/mtab} is a dynamic table of currently mounted file systems. \begin{itemize} \begin{overlay}{1} \item This file is secret kernel business. \end{overlay} \begin{overlay}{2} \item Do *not* edit this file. \end{overlay} \begin{overlay}{3} \item Ever. \end{overlay} \end{itemize} \begin{overlay}{4} \begin{alltt} \$ cat /etc/mtab \(\hookleftarrow\) /dev/hda6 / ext2 rw 0 0 none /proc proc rw 0 0 none /dev/pts devpts rw,gid=5,mode=620 0 0 /dev/hda1 /mnt/disk vfat rw 0 0 \end{alltt} \end{overlay} \begin{overlay}{5} \begin{alltt} \$ mount \(\hookleftarrow\) /dev/hda6 on / type ext2 (rw) none on /proc type proc (rw) none on /dev/pts type devpts (rw,gid=5,mode=620) /dev/hda1 on /mnt/disk type vfat (rw) \end{alltt} \end{overlay} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Disk usage---\texttt{du}} \begin{alltt} \$ du \(\hookleftarrow\) 24 ./vmware/win2000 961136 ./vmware/nt4 961164 ./vmware 20 ./.netscape/cache 4 ./.netscape/archive 968164 . \end{alltt} \begin{overlay}{1} \slidesubsubheading{Disk filesystem usage---\texttt{df}} \begin{alltt} \$ df \(\hookleftarrow\) Filesystem 1k-blocks Used Available Use% Mounted on /dev/hda6 3755460 3041736 522956 86% / /dev/hda1 2044240 614664 1429576 31% /mnt/disk \end{alltt} \end{overlay} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Managing disk quota [1]} \slidesubsubheading{Objective} Candidates should be able to manage disk quotas for users. This objective includes setting up a disk quota for a filesystem, editing, checking, and generating user quota reports. \slidesubsubheading{Key files, terms, and utilities include:} See 104-4.tex \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Use file permissions to control access to files [3]} \slidesubsubheading{Objective} Candidates should be able to control file access through permissions. This objective includes access permissions on regular and special files as well as directories. Also included are access modes such as suid, sgid, and the sticky bit, the use of the group field to grant file access to workgroups, the immutable flag, and the default file creation mode. \slidesubsubheading{Key files, terms, and utilities include:} \begin{alltt} chmod umask chattr \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Manage file ownership [2]} \slidesubsubheading{Objective} Candidates should be able to control user and group ownership of files. This objective includes the ability to change the user and group owner of a file as well as the default group owner for new files. \slidesubsubheading{Key files, terms, and utilities include:} \begin{alltt} chmod chown chgrp \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Create and change hard and symbolic links [2]} \slidesubsubheading{Objective} Candidates should be able to create and manage hard and symbolic links to a file. This objective includes the ability to create and identify links, copy files through links, and use linked files to support system administration tasks. \slidesubsubheading{Key files, terms, and utilities include:} \begin{alltt} ln \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{ln} link} A \textit{link} is a pseudofile that creates a shortcut to the original file located elsewhere on the filesystem. \begin{description} \item [Symbolic links] \item [Hard links] \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Linux files and \textit{inodes}} Creating a file with a command such as: \begin{alltt} \$ cat -n "Hello" > foo \end{alltt} \begin{enumerate} \item An \textit{inode} number in the superblock is allocated to the file \item The files inode is populated with information \item A directory entry (Hard link) is made in a directory file \item The file's data is written to a place on the disk pointed to by the \textit{inode} \end{enumerate} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Linux files and \textit{inodes}} \fbox{\epsfig{file=images/links2.fig.eps,height=.6\textwidth}} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{The \textit{inode} information} Some of the information contained in a file's inode can be displayed with the \texttt{ls} command: \begin{alltt} \$ ls -il foo 2723514 -rw-r--r-- 2 geoff geoff 16 Mar 22 09:38 /tmp/foo \end{alltt} A more complete view of inode information may be had with \texttt{stat}: \small \begin{alltt} \$ stat foo File: "/tmp/foo" Size: 5 Blocks: 2 IO Block: 4096 Regular File Device: 802h/2050d Inode: 2723514 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 1000/geoffrey) Gid: ( 1000/geoffrey) Access: Fri Mar 22 08:25:00 2002 Modify: Fri Mar 22 09:38:19 2002 Change: Fri Mar 22 09:52:26 2002 \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\textit{Hard links} are directory entries} A file may have one or more \textit{hard links} to it. Additional \textit{hard links} are made with the \texttt{ln} command: \begin{alltt} \$ ln foo bar \$ ls -il foo bar 2723514 -rw-r--r-- 2 geoff geoff 5 Mar 22 09:38 bar 2723514 -rw-r--r-- 2 geoff geoff 5 Mar 22 09:38 foo \end{alltt} \begin{itemize} \item there is only one file on the disk \item it has one inode \item it has two names (hard links) \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Hard links are directory entries} \fbox{\epsfig{file=images/links3.fig.eps,height=.6\textwidth}} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{foo} a.k.a. \texttt{bar}} \begin{alltt} \$ chmod 640 foo \$ ls -il foo bar 2723514 -rw-r----- 2 geoff geoff 5 Mar 22 09:38 bar 2723514 -rw-r----- 2 geoff geoff 5 Mar 22 09:38 foo \$ echo " there" >> bar \$ head foo bar ==> foo <== Hello there ==> bar <== Hello there \$ ls -il foo bar 2723514 -rw-r----- 12 geoff geoff 5 Mar 22 09:38 bar 2723514 -rw-r----- 12 geoff geoff 5 Mar 22 09:38 foo \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Hard link constraints} \begin{itemize} \item Hard links are confined within the volume: \begin{alltt} \$ ln foo ~/fred ln: creating hard link `/home/geoffrey/fred' to `foo': Invalid cross-device link \end{alltt} \item Directories may not have multiple hard links: \begin{alltt} \$ ln /tmp doh ln: `/tmp': hard link not allowed for directory \end{alltt} \item \texttt{ln} declines to clobber unless forced: \begin{alltt} \$ ln foo bar ln: `bar': File exists \$ ln -f foo bar \$ \end{alltt} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Symbolic links} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{A \textit{symbolic link} is a file that points to another } \fbox{\epsfig{file=images/links4.fig.eps,height=.6\textwidth}} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Linux files and \textit{inodes}} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Linux files and \textit{inodes}} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Linux files and \textit{inodes}} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Find system files, place files in the correct location [2]} \slidesubsubheading{Objective} Candidates should be thoroughly familiar with the Filesystem Hierarchy Standard, including typical file locations and directory classifications. This objective includes the ability to find files and commands on a Linux system. \slidesubsubheading{Key files, terms, and utilities include:} \begin{alltt} find locate slocate updatedb whereis which /etc/updatedb.conf \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Subsections of 104.8} \begin{itemize} \item Data Types \item The filesystem layout \item find \item locate, slocate, updatedb and /etc/updatedb.conf \item whereis, which and apropos \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Data Types---FHS Classification} \begin{description} \item[Data sharing] scope of data used in networked environments: \begin{description} \overlay{1} \item[Shareable] Data used on multiple hosts across a network---data files, many executables and common configuration files. \overlay{2} \item[Non-shareable] Files relevant to a paticular host---system logs, etc. \end{description} \overlay{3} \item[Data modification] How data changes. \overlay{4} \begin{description} \item[Variable] Data that changes normal frequent processes---log files, user data etc. \overlay{5} \item[Static] Data that does not normally change day to day---binary programs and most of /etc \end{description} \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{FHS Data Types} \bigskip {\Large \begin{tabbing} foobarbazfoo \= foobarbazfoobarbaz \= \kill \> Shareable \> Non-shareable \\ Static \> \texttt{/usr} \> \texttt{/etc} \\ \> \texttt{/usr/local} \> \texttt{/boot}\\[5mm] Variable \> \texttt{/vavr/mail} \> \texttt{/var/log}\\ \> \texttt{/home} \> \texttt{/proc} \end{tabbing} } \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{The Linux Filesystem} \begin{alltt} \$ ./tree -L 2 -d / / |-- bin |-- boot | |-- grub | `-- lost+found |-- dev | `-- video |-- etc | |-- CORBA | |-- X11 | |-- alchemist | |-- cron.d | |-- cron.daily | |-- cron.hourly | |-- cron.monthly \end{alltt}%$ \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{The Linux Filesystem} \begin{verbatim} |-- home | |-- geoffrey | `-- lost+found |-- initrd |-- lib | |-- i686 | |-- iptables | |-- kbd | |-- modules | `-- security |-- lost+found |-- misc |-- mnt | |-- cdrom | |-- floppy | `-- hda8 \end{verbatim}%$ \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{The Linux Filesystem} \begin{verbatim} |-- opt | `-- prenticehall_cyberclassroom |-- proc | |-- 1 | |-- scsi | |-- sys |-- root |-- sbin |-- tmp |-- usr | |-- X11R6 | |-- apps | |-- bin \end{verbatim}%$ \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{The Linux Filesystem} \begin{verbatim} |-- var | |-- arpwatch | |-- cache | |-- db | |-- lock | |-- log | |-- mail -> spool/mail `-- win |-- Adobe Albums |-- Dell |-- My Documents | `-- zip \end{verbatim}%$ \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{The First Level Directories} \large \begin{description} \item[\opt{/boot}] Files for the boot loader. \overlay{1}% \item[\opt{/dev}] Device files for accessing devices. \overlay{2}% \item[\opt{/etc}] Configuration files. \overlay{3}% \item[\opt{/home}] Home directories for system users. \overlay{4}% \item[\opt{/lib}] Shared libraries and kernel modules. \overlay{5}% \item[\opt{/mnt}] Mount points for temporary partitions. \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{The First Level Directories} \large \begin{description} \item[\opt{/opt}] Location for 3rd party applications. \overlay{1}% \item[\opt{/proc}] Virtual filesystem created by the kernel. \overlay{2}% \item[\opt{/root}] Home for the superuser. \overlay{3}% \item[\opt{/sbin}] Esential utilities for system administration \overlay{4}% \item[\opt{/tmp}] Storage for temporary files---cleared at boot time. \overlay{5}% \item[\opt{/usr}] Hierarchy of non esential executables etc. \overlay{6}% \item[\opt{/var}] Hierarchy of variable data. \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{The Filesystem partitions} \begin{alltt} geoffrey@mintie:~\$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 3.2G 2.7G 357M 89% / /dev/sda2 182M 57M 116M 33% /tmp /dev/sda3 273M 89M 170M 35% /var /dev/hda1 99M 21M 72M 23% /boot /dev/hda2 99M 13M 80M 14% /boot~ /dev/hda3 9.6G 8.6G 624M 94% /home /dev/hda5 14G 7.1G 6.6G 52% /usr/local /dev/hda6 4.8G 1021M 3.5G 22% /var/cache/apt/archives /dev/hda7 4.8G 20k 4.5G 1% /backups /dev/hda8 2.8G 318M 2.3G 12% /var/lib /dev/hdc1 1.9G 1.2G 739M 61% /mnt/hdc1 \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{The Filesystem partitions} \begin{description} \item[\opt{/}] \texttt{(root)} Small partition containing the files esential for booting the system. \overlay{1}% \item[\opt{/boot}] Files for the boot loader. \overlay{2}% \item[\opt{/home}] Home directories for system users. \overlay{3}% \item[\opt{/opt}] Location for 3rd party applications. \overlay{4}% \item[\opt{/tmp}] Storage for temporary files---cleared at boot time. \overlay{5}% \item[\opt{/usr}] Hierarchy of non esential executables etc. \overlay{6}% \item[\opt{/var}] Hierarchy of variable data. \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{The \texttt{root} Filesystem: Esentials} \begin{description} \item[\opt{/bin}] \item[\opt{/dev}] \item[\opt{/etc}] \item[\opt{/lib}] \item[\opt{/mnt}] \item[\opt{/root}] \item[\opt{/sbin}] \item[\opt{/lib}] \end{description} \medskip \hrule \overlay{1} Also required: \opt{/boot} and \opt{swap} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{The \texttt{/usr} Filesystem} \large \begin{description} \item[\opt{/usr/X11R6}] Files for XFree86. \overlay{1}% \item[\opt{/usr/bin}] User commands not needed for emergency maintenance. \overlay{2}% \item[\opt{/usr/games}] Area for console games. \overlay{3}% \item[\opt{/usr/include}] Header files for C and C++. \overlay{4}% \item[\opt{/usr/lib}] Shared program libraries. (+perl modules) \overlay{5}% \item[\opt{/usr/local}] Hierarchy for local files not in distribution. \overlay{6}% \item[\opt{/usr/sbin}] System administration utilities not essential for emergency system maintenance. \overlay{7}% \item[\opt{/usr/share}] Hierarchy of data files that are hardware independent. (e.g. documentation) \overlay{8}% \item[\opt{/usr/src}] Linux source code. \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{The \texttt{/var} Filesystem} \large \begin{description} \item[\opt{/var/account}] Can be used for process accounting data. \overlay{1}% \item[\opt{/var/cache}] Temporary storage of intermaediate data. \overlay{2}% \item[\opt{/var/crash}] Crash dumps. \overlay{3}% \item[\opt{/var/games}] Console game saves and score data. \overlay{4}% \item[\opt{/var/lock}] Lock files for various programs. \overlay{5}% \item[\opt{/var/log}] Main repository for system log files. \overlay{6}% \item[\opt{/var/mail}] System mailbox containing mail files for users. \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{The \texttt{/var} Filesystem} \large \begin{description} \item[\opt{/var/opt}] Transient srorage for 3rd party programs. \overlay{1}% \item[\opt{/var/run}] Files describing the current state of the system. \overlay{2}% \item[\opt{/var/spool}] Information that is queued for processing. (e.g. print jobs) \overlay{3}% \item[\opt{/var/state}] Data for applications with multiple instances. \overlay{4}% \item[\opt{/var/tmp}] A more persistant version of \texttt{/tmp}. \overlay{5}% \item[\opt{/var/yp}] Database files for NIS. \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{find} - search for files in a directory hierarchy} The find command is one of the fundamental tools of Unix. It is a tool that is constantly rediscovered as you perform more and more complex operations with it. The man page of this simple tool is 555 lines long. \vspace{10mm} \hrule To find the file \texttt{foo.txt} somewhere: \begin{alltt} \$find / -name foo.txt \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{find} - basic use} \begin{itemize} \item The most basic use of find is: \begin{alltt} \$find -name "" \end{alltt} \item To find a missing file somewhere in you home directory \begin{alltt} \$ find ~ -name missing.file \end{alltt} where \~{} is shorthand for your home directory. \begin{overlay}{1} \item You can also use masks like \texttt{"*.txt.gz"} but you must put it in quotes.\\ --- Why do you have to put it in quotes? \end{overlay} \begin{overlay}{2} \item When you use an * in a bash command line it is interpreted as a file expansion and it is looked for in the current directory and if it does exist it is substituted before the command is sent to find. If it is not found then your shell may generate an error message (for example csh, I think). \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{find} - basic options} According to the man page 'find - search for files in a directory hierarchy' This is true but you can also find directories as well, like the filesystems . First we will start with some basic options: \begin{description} \item[\texttt{-print}] list the filename (default, never really use it). \item[\texttt{-exec}] run a command \item[\texttt{-ok}] run a command after prompting for confirmation. \item[\texttt{-ls}] list file like \texttt{`ls -dils`}, is a lot of file information. \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{find} - advanced options} Advanced doing options, I am sure you will use these one day: \begin{description} \item[\texttt{-prune}] don't descend past this directory. \item[\texttt{-printf}] print a filename based on format like C printf. \item[\texttt{-print0}] print but end with a null character. \item[\texttt{-fprintf $<$fn$>$}] print a format string to a filename, (scripting??) \item[\texttt{-fprint $<$fn$>$}] print filenames to a file. \item[\texttt{-fls $<$fn$>$}] ls to a file \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{find} - entry selection by age} Most of these options take a \textit{number}, \textit{+number} or \textit{-number}. A little explanation is required first. \begin{description} \item[\texttt{-atime 2}] Will pick any file accessed two days ago. \item[\texttt{-atime -2}] Will pick any file access more than two days ago \item[\texttt{-atime +2}] Will pick any file accessed in the last day. \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{find} - entry selection by age} Most of these options take a \textit{number}, \textit{+number} or \textit{-number}. A little explanation is required first. \begin{description} \item[\texttt{-atime n}] files on access date \item[\texttt{-ctime n}] files on creation date (note chmod mucks this up \item[\texttt{-mtime n}] files on modification date \item[\texttt{-anewer $<$file$>$}] files on access date based on another file. \item[\texttt{-cnewer$<$file$>$}] files on creation date based on another file. \item[\texttt{-newer $<$file$>$}] files on modification date based on another file \end{description} \underline{Example:} delete all files older than 7 days in the \texttt{/data} directory who have an \texttt{.A} extension. \begin{overlay}{1} \vspace{10mm}\hrule \begin{verbatim} $ find /data -name "*.A" -ctime -7 -exec rm {} \; \end{verbatim}%$ \end{overlay} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{find} - entry selection by age} \begin{itemize} \item A script may run a command and then 'touch' a tag file to give a timestamp when it was run. \item Assume that the last thing a script does is touch modification.tag in the \texttt{/parms} directory. \item Write a command line that lists all details of files modified in the \texttt{/apps/source/} directory based on this tag file. \begin{overlay}{1} \vspace{10mm}\hrule \begin{verbatim} $ find /data -mnewer /parms/modification.tag -ls \end{verbatim}%$ \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{find} - entry selection by owner and group} One problem with the Unix authentification system, when you delete a userid you end up with magic numbers on a directory listing. It is handy to be able to change the ownership on all files from the exiting staff member to the new person working on those projects. \begin{description} \item[\texttt{-nouser}] users numeric id does not have and entry in /etc/passwd \item[\texttt{-nogroup}] group numeric id does not have an entry in /etc/group \item[\texttt{-uid n}] User by number \item[\texttt{-user name}] User by name \item[\texttt{-gid n}] Group by number \item[\texttt{-group name}] Group by name \end{description} I recently converted from Redhat to Debian. I installed a new harddisk and mounted the old one as \texttt{/mnt/old1}. I notice that when I do \texttt{ls -al} I get a username of 500 in the directory listing. Change all the occurrences of 500 to the username of ken. \begin{overlay}{1} \vspace{3mm}\hrule \begin{verbatim} # find /mnt/old1 -uid 500 -exec chown ken {} \; \end{verbatim}%$ \end{overlay} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{find} - entry selection by Inode number and links} You have a directory listing, the hard link count is greater than 1. ... lecturers note wait and ask class how we know this .... You have no idea where the other hard link is and you want to locate the other version to see what impact a change may have. \begin{alltt} -inode n \end{alltt} \begin{overlay}{1} \vspace{3mm}\hrule \begin{verbatim} # find -inode ???? \end{verbatim}%$ \end{overlay} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{find} - entry selection by regex and xdev} Advanced options on what entries we select: \texttt{-iregex} Use regex rather than standard file masks. Options on how we go through the directories: \texttt{-xdev} don't go into other file systems. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{locate}, \texttt{slocate} and \texttt{updatedb}} \texttt{locate} is used to find files on the system using a database rather than actually having to search the entire directory tree. \begin{alltt} \$ locate slide.tex \(\hookleftarrow\) /home/geoffrey/tafe/adp/bash/slide.tex \end{alltt} \begin{itemize} \begin{overlay}{1} \item \texttt{updatedb} is the command that updates the database. \end{overlay} \begin{overlay}{2} \item The database is kept in \texttt{/var/lib/locate/locatedb} \end{overlay} \begin{overlay}{3} \item \texttt{slocate} The Security Enhanced version of the GNU Locate--- now replaces all of these. \texttt{locate} and \texttt{updatedb} become a symbolic links to \texttt{slocate} \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{locate} vs. \texttt{slocate}} \begin{itemize} \begin{overlay}{1} \item The \texttt{locate} command as now been replaced by \texttt{slocate} and is now a Symbolic link to \texttt{slocate}. \end{overlay} \begin{overlay}{2} \item The \texttt{updatedp} command as now been replaced by \texttt{slocate} and is now a Symbolic link to \texttt{slocate}. \end{overlay} \begin{overlay}{3} \small \begin{alltt} \$ ls -l /usr/bin/ |grep locate \(\hookleftarrow\) lrwxrwxrwx 1 root root 7 Mar 27 10:44 locate -> slocate* -rwxr-xr-x 1 root root 9228 Nov 5 2000 locate.notslocate* -rwxr-sr-x 1 root slocate 24504 Feb 4 03:57 slocate* lrwxrwxrwx 1 root root 7 Mar 27 10:44 updatedb -> slocate* -rwxr-xr-x 1 root root 5860 Nov 5 2000 updatedb.notslocate* \end{alltt} \normalsize \end{overlay} \begin{overlay}{4} \item The database is now in \texttt{/var/lib/slocate/slocatedb} \item The database is no longer world readable \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{slocate} - Security Enhanced version of the GNU Locate} \begin{itemize} \begin{overlay}{1} \item Slocate is used to find files on the system without actually having to search the entire directory tree. \end{overlay} \begin{overlay}{2} \item A database of all files on the system is created and is then used by slocate to reveal the files actual location. \end{overlay} \begin{overlay}{3} \item It is important to note that slocate may return a result which is no longer valid since the directory structure may have been modified since the slocate database was last created. \end{overlay} \begin{overlay}{4} \item For example, you create a file called poobar.txt, create the slocate database and then remove poobar.txt. \end{overlay} \begin{overlay}{5} \item Slocate will still return poobar.txt?s original location until the slocate database is recreated. \end{overlay} \begin{overlay}{6} \item Slocate can be used in two modes: \begin{itemize} \item Search mode:- To locate an actual file within the database \item Database creation mode:- To build the database \end{itemize} \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{locate} usage} \begin{alltt} locate [-qi] [-d ] [-r ] ... \end{alltt} Options: \begin{description} \item[\texttt{-q}] Quiet mode. Suppress error messages. \item[\texttt{-i}] \underline{Does a case insensitive search.} \item[\texttt{-d}] \underline{Specify a database to use.} \item[\texttt{-r}] Pass a regular expression instead of a search string. \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{locate} examples} \begin{description} \item[\texttt{locate ls}] \begin{alltt} \$ locate ls \(\hookleftarrow\) ... /etc/X11/xkb/symbols/xfree68/ataritt /etc/X11/xkb/symbols/xfree68/amiga /etc/alternatives/tclsh ... \end{alltt} \item[\texttt{locate -r "/ls\$"}] \begin{alltt} \$ locate -r "/ls\$" \(\hookleftarrow\) /home/geoffrey/tafe/mos/compress/ls /usr/lib/bitchx/help/8_Scripts/ls /bin/ls \end{alltt} \end{description} The above example illustrates the need for a \textsf{regex} option to \texttt{locate}. In the first example there will be lots of hits. In the second there is only one (the actual \texttt{ls} command). As well as searching for a file in the database, \texttt{locate} can also build the search database. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Database creation with \texttt{slocate}} As well as searching for a file in the database, slocate can also build the search database. \begin{description} \item[\texttt{-u}] \underline{Create slocate database starting at path \texttt{/}.} \item[\texttt{-U $<$dir$>$}] \underline{Create slocate database starting at path $$.} \item[\texttt{-c}] \underline{Parse original GNU Locate's \texttt{/etc/updatedb.conf}} \item[\texttt{-e $<$dir1...$>$}] \underline{Exclude directories from the slocate database when using the -u or -U options.} \item[\texttt{-f $<$fs...$>$}] Exclude file system types from the slocate database \item[-l] Security level. 0--$>$ security off, 1--$>$ security on \item[\texttt{-q}] Quiet mode. Error messages are suppressed. \item[\texttt{-o $<$file$>$}] \underline{Specify the name of the database file to create} \item[\texttt{-v}] Be verbose \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Database creation with \texttt{slocate}--- Examples} \begin{itemize} \begin{overlay}{1} \item Create a database for all directories under \texttt{/usr} and place the resulting database file into \texttt{slocate.db} in andy's home directory. \begin{alltt} \# slocate -U /usr -o /home/andy/slocate.db \(\hookleftarrow\) \end{alltt} \end{overlay} \begin{overlay}{2} \item Create a database for all directories under /usr, excluding directories under /usr/man and place the resulting database file into slocate.db in andy?s home directory. \begin{alltt} \# slocate -U /usr -e /usr/man -o /home/andy/slocate.db \(\hookleftarrow\) \end{alltt} \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{Update \texttt{slocate} database---\texttt{update}} \texttt{updatedb} is simply a link to slocate that implies the -u option. (Excerpt from the man page:- man updatedb) \small \begin{alltt} \$ ls -l `which updatedb` \(\hookleftarrow\) lrwxrwxrwx 1 root root 7 Mar 27 10:44 /usr/bin/updatedb -> slocate* \end{alltt} \normalsize \texttt{updatedb} is typically executed periodically via \textsf{cron}. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{/etc/updatedb.conf}} \begin{itemize} \begin{overlay}{1} \item The \texttt{updatedb} (or \texttt{slocate}) tool can use a configuration file to decide which directories and file systems are included when the database is created. This file is normally located in \texttt{/etc/updatedb.conf} \end{overlay} \begin{overlay}{2} \item The following is a list of keywords that are recognised by updatedb (slocate) and their equivalent command line options \begin{description} \item[\texttt{PRUNEFS}] \texttt{$<$fs\_type1 fs\_type2...$>$} - Option \texttt{-f} \item[\texttt{PRUNEPATHS}] \texttt{$<$dir1 dir2 dir3...$>$} - Opion \texttt{-e} \end{description} \end{overlay} \begin{overlay}{3} \item Example \texttt{updatedb.conf} \begin{alltt} PRUNEFS="devpts NFS nfs afs proc smbfs autofs auto iso9660" PRUNEPATHS="/tmp /usr/tmp /var/tmp /afs /net? export PRUNEFS export PRUNEPATHS \end{alltt} \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{slocate} Exercises} \begin{enumerate} \item Create an \texttt{slocate} database in your home directory including all directories from \texttt{/} down. \item Using the database created in step 1, locate all files with \texttt{rm} in the filename \item Using the database created in step 1, locate the executable file \texttt{rm} using a regex. (ie \texttt{/some/path/rm}) \item Create an slocate database in your home directory include all directories from \texttt{/} down but excluding the \texttt{/bin} directory. \item Repeat (2) and (3) above. Do you notice anything different ? \item After backing up your existing \texttt{/etc/updatedb.conf}, say \begin{alltt} \# cp /etc/updatedb.conf /etc/updatedb.conf.orig \(\hookleftarrow\) \end{alltt} edit \texttt{/etc/updatedb.conf} to perform the same actions as in step (4). \item When you have finished this exercise restore your original \texttt{/etc/updatedb.conf}. \end{enumerate} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{whereis}} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{which}} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{/etc/updatedb.conf}} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide}{} \Slidecontents \end{slide} %--------------------------------------- %============================================================================== %============================================================================== %============================================================================== \begin{slide}\setcounter{slidesection}{105} \slideheading{(2.6)Boot, Initialization, Shutdown, Runlevels [6]} \begin{enumerate} \item Boot the system [3] \item Change runlevels and shutdown or reboot system [3] \end{enumerate} \vfill \end{slide} %------------------------------------------------------------------------------ %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Boot the system [3]} \slidesubsubheading{Objective} Candidates should be able to guide the system through the booting process. This includes giving commands to the boot loader and giving options to the kernel at boot time, and checking the events in the log files. \slidesubsubheading{Key files, terms, and utilities include:} \begin{alltt} dmesg /var/log/messages /etc/conf.modules or /etc/modules.conf \end{alltt} \slidesubsubheading{Resources} TBA \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Change runlevels and shutdown or reboot system [3]} \slidesubsubheading{Objective} Candidates should be able to manage the runlevel of the system. This objective includes changing to single user mode, shutdown or rebooting the system. Candidates should be able to alert users before switching runlevel, and properly terminate processes. This objective also includes setting the default runlevel. \slidesubsubheading{Key files, terms, and utilities include:} \begin{alltt} shutdown init /etc/inittab \end{alltt} \slidesubsubheading{Resources} TBA \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{} \begin{itemize} \begin{overlay}{1} \item a \end{overlay} \begin{overlay}{2} \item b \end{overlay} \begin{overlay}{3} \item c \begin{alltt} \end{alltt} \end{overlay} \begin{overlay}{4} \item d \end{overlay} \begin{overlay}{5} \item e \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %\SlideColours{red}{black} \begin{slide}{} \Slidecontents \end{slide} %--------------------------------------- %============================================================================== %============================================================================== %============================================================================== \begin{slide}\setcounter{slidesection}{107} \slideheading{(1.8) Documentation [8]} \begin{enumerate} \item Use and manage local system documentation [5] \item Find Linux documentation on the Internet [2] \item Write System Documentation [1] \item Provide User Support [1] \item Notify users on system-related issues [1] \end{enumerate} \vfill \end{slide} %------------------------------------------------------------------------------ %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Use and manage local system documentation [5]} \slidesubsubheading{Objective} Candidates should be able to use and administer the man facility and the material in \texttt{/usr/share/doc/}. This objective includes finding relevant man pages, searching man page sections, finding commands and man pages related to them, and configuring access to man sources and the man system. It also includes using system documentation stored in \slidesubsubheading{Key files, terms, and utilities include:} \begin{alltt} man apropos whatis MANPATH \end{alltt} \slidesubsubheading{Resources} TBA \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Find Linux documentation on the Internet [2]} \slidesubsubheading{Objective} Candidates should be able to find and use Linux documentation. This objective includes using Linux documentation at sources such as the Linux Documentation Project (LDP), vendor and third-party websites, newsgroups, newsgroup archives, and mailing lists. \slidesubsubheading{Key files, terms, and utilities include:} \begin{alltt} not applicable \end{alltt} \slidesubsubheading{Resources} TBA \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Notify users on system-related issues [1]} \slidesubsubheading{Objective} Candidates should be able to notify the users about current issues related to the system. This objective includes automating the communication process, e.g. through logon messages. \slidesubsubheading{Key files, terms, and utilities include:} \begin{alltt} /etc/issue /etc/issue.net /etc/motd \end{alltt} \slidesubsubheading{Resources} TBA \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{} \begin{itemize} \begin{overlay}{1} \item a \end{overlay} \begin{overlay}{2} \item s \end{overlay} \begin{overlay}{3} \item s \begin{alltt} \end{alltt} \end{overlay} \begin{overlay}{4} \item s \end{overlay} \begin{overlay}{5} \item s \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide}{} \Slidecontents \end{slide} %--------------------------------------- %============================================================================== %============================================================================== %============================================================================== \begin{slide}\setcounter{slidesection}{110} \slideheading{(2.11) Administrative Tasks [24]} \begin{enumerate} \item Manage users and group accounts and related system files [7] \item Tune the user environment and system environment variables [4] \item Configure and use system log files to meet administrative and security needs [3] \item Automate system administration tasks by scheduling jobs to run in the future [4] \item Maintain an effective data backup strategy [3] \item Maintain system time [3] \end{enumerate} \vfill \end{slide} %------------------------------------------------------------------------------ %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Manage user/group accounts, related system files [7]} \slidesubsubheading{Objective} Candidate should be able to add, remove, suspend and change user accounts. Tasks include to add and remove groups, to change user/group info in passwd/group databases. The objective also includes creating special purpose and limited accounts. \slidesubsubheading{Key files, terms, and utilities include:} \begin{alltt} chageg passwd groupadd groupdel groupmod grpconv grpunconv passwd pwconv pwunconv useradd userdel usermod /etc/passwd /etc/shadow /etc/group /etc/gshadow \end{alltt} \slidesubsubheading{Resources} Chapter 9 - Managing User Accounts: The Linux System Administrators' Guide Manpages for \texttt{useradd usermod userdel groupadd groupmod groupdel useradd passwd chage} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{The \texttt{/etc/passwd} file} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{useradd} - Create a new user or update new user information} {\bf \texttt{\# useradd [options] user}} Options: \begin{description} \item[\bf \texttt{-c}] ``comment'' GCOS field---Users name \item[\bf \texttt{-d homedir}] Use \texttt{homedir} as the users home directory \item[\bf \texttt{-D}] List and optionally change the default values \item[\bf \texttt{-m}] Create and populate the users home directory \item[\bf \texttt{-s shell}] Use \texttt{shell} as the users shell \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{useradd}---examples} \begin{itemize} \item The defaults: \begin{alltt} # useradd -D GROUP=100 HOME=/home INACTIVE=-1 EXPIRE= SHELL=/bin/bash SKEL=/etc/skel \end{alltt} \begin{overlay}{1} \item Vanilla \texttt{}: \begin{alltt} \# useradd quincy \end{alltt} \end{overlay} \begin{overlay}{2} \item With nuts: \begin{alltt} \# useradd -m -c "Quincy Shnorks" -s zsh quincy \end{alltt} \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{passwd} - change user password} \begin{itemize} \item The command: \begin{alltt} \$ which passwd /usr/bin/passwd \end{alltt} \begin{overlay}{1} \item \texttt{passwd} changes passwords for user and group accounts. \end{overlay} \begin{overlay}{2} \item A normal user may only change the password for their own account \end{overlay} \begin{overlay}{3} \item The super user may change the password for any account. \end{overlay} \begin{overlay}{4} \item The administrator of a group may change the password for the group. \end{overlay} \begin{overlay}{5} \item \texttt{passwd} also changes account information, such as the full name of the user, their login shell, or password expiry dates and intervals. \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{passwd} example} \begin{itemize} \item A user may change their own password: \begin{alltt} \$ passwd Changing password for geoffrey (current) UNIX password: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully \end{alltt} \begin{overlay}{1} \item Assuming \textsf{root} privileges: \begin{alltt} \$ su - Password: \end{alltt} \end{overlay} \begin{overlay}{2} \item \textsf{root} may change any passwd: \begin{alltt} \# passwd geoffrey Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully \end{alltt} \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{\texttt{passwd} guidelines} As a general guideline, passwords should consist of 6 to 8 characters including one or more from each of following sets: \begin{itemize} \item Lower case alphabetics \item Upper case alphabetics \item Digits 0 through 9 \item Punctuation marks \end{itemize} Examples of secure and memorable passwds: \begin{itemize} \item The Owl and the Pussycat went to sea---\verb+TO&tPw2s+ \item I got it---\verb+1_got_IT+ \item One and all.--- \verb+1_&_All.+ \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{} \begin{itemize} \begin{overlay}{1} \item a \end{overlay} \begin{overlay}{2} \item s \end{overlay} \begin{overlay}{3} \item s \begin{alltt} \end{alltt} \end{overlay} \begin{overlay}{4} \item s \end{overlay} \begin{overlay}{5} \item s \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Tune user and system environment variables [4]} \slidesubsubheading{Objective} Candidate should be able to modify global and user profiles. This includes setting environment variables, maintaining skel directories for new user accounts and setting command search path with the proper directory. \slidesubsubheading{Key files, terms, and utilities include:} \begin{alltt} env export set unset /etc/profile /etc/skel \end{alltt} \slidesubsubheading{Resources} TBA \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} %Geoffrey Robertson \slidesubheading{Config \& use system log files for admin / security [3]} \slidesubsubheading{Objective} Candidate should be able to configure system logs. This objective includes managing the type and level of information logged, manually scanning log files for notable activity, monitoring log files, arranging for automatic rotation and archiving of logs and tracking down problems noted in logs. \slidesubsubheading{Key files, terms, and utilities include:} \begin{alltt} logrotate /etc/syslog.conf /var/log/* tail -f \end{alltt} \slidesubsubheading{Resources} TBA \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} %Geoffrey Robertson \slidesubheading{Automate system admin tasks by job scheduling[4]} \slidesubsubheading{Objective} Candidate should be able to use \texttt{cron} or \texttt{anacron} to run jobs at regular intervals and to use at to run jobs at a specific time. Task include managing cron and at jobs and configuring user access to cron and at services. \slidesubsubheading{Key files, terms, and utilities include:} \begin{alltt} at atq crontab /etc/anacrontab /etc/at.deny /etc/at.allow /etc/crontab /etc/cron.allow /etc/cron.deny /var/spool/cron/* \end{alltt} \slidesubsubheading{Resources} TBA \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== %============================================================================== \begin{slide} %Geoffrey Robertson \slidesubheading{Maintain an effective data backup strategy [3]} \slidesubsubheading{Objective} Candidate should be able to plan a backup strategy and backup filesystems automatically to various media. Tasks include dumping a raw device to a file or vice versa, performing partial and manual backups, verifying the integrity of backup files and partially or fully restoring backups. \slidesubsubheading{Key files, terms, and utilities include:} \begin{alltt} cpio dd dump restore tar \end{alltt} \slidesubsubheading{Resources} TBA \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{System Backup Tools} Backing up a system is a vital part of system administration. A good backup strategy involves the following key features: \begin{itemize} \overlay{1} \item Frequent backups (at least daily) \overlay{2} \item Backup media is maintained on a rotating basis (eg 28 sets of backup media, rotated daily) \overlay{3} \item At least one copy of the backup should be kept off-site \overlay{4} \item Backup must have been tested \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{Backup Tools} There are many strategies used for system backups. These range from copying a simple file to entire disk partitions to an entire disk. Some tools available under linux are: \begin{itemize} \overlay{1} \item dump / restore \overlay{2} \item rsync \overlay{3} \item cpio \overlay{4} \item ar \overlay{5} \item tar \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{Dump \& Restore} \begin{description} \item[\opt{Dump}] Saves source files or filesystems to backup media\\ (Like the DOS backup utility) \item[\opt{Restore}] Reinstate the backup to files or filesystems\\ (Like the DOS restore utility) \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{\opt{dump} usage} \begin{itemize} \item Dump has 22 options, many of which concern themselves with various tape device setup options (density, tape length, etc.) \overlay{1} \item To dump the \texttt{/boot} directory (in my case a seperate partition), do the following: \begin{alltt} \cmd{/sbin/dump -0u -f /root/boot.backup /boot} \end{alltt} \begin{description} \overlay{2} \item[\opt{-0}(zero)] tells dump to do the entire directory \overlay{3} \item[\opt{-u}] update the file \texttt{/etc/dumpdates} \overlay{4} \item[\opt{-f}] write the backup to a file \end{description} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{Dump Usage Example:} \scriptsize \begin{alltt} [root@Node4] root]# df -h /boot Filesystem Size Used Avail Use% Mounted on /dev/hda5 197M 4.1M 183M 3% /boot \end{alltt} \overlay{1} \begin{alltt} [root@Node4] root]# dump -0u -f /root/boot.backup /boot DUMP: Date of this level 0 dump: Tue May 7 20:30:36 2002 DUMP: Dumping /dev/hda5 (/boot) to /root/boot.backup DUMP: Label: /boot DUMP: mapping (Pass I) [regular files] DUMP: mapping (Pass II) [directories] DUMP: estimated 4224 tape blocks. DUMP: Volume 1 started with block 1 at: Tue May 7 20:30:37 2002 DUMP: dumping (Pass III) [directories] DUMP: dumping (Pass IV) [regular files] DUMP: Closing /root/boot.backup DUMP: Volume 1 completed at: Tue May 7 20:30:37 2002 DUMP: Volume 1 4210 tape blocks (4.11MB) DUMP: 4210 tape blocks (4.11MB) on 1 volume(s) DUMP: finished in less than a second DUMP: Date of this level 0 dump: Tue May 7 20:30:36 2002 DUMP: Date this dump completed: Tue May 7 20:30:37 2002 DUMP: Average transfer rate: 0 kB/s DUMP: DUMP IS DONE \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{Restore} Restore takes the data created by the dump command and puts it back to the filesystem. \overlay{1} Restore can be used in one of these modes: \begin{itemize} \overlay{2} \item Compare - Verify backup file against filesystem \overlay{3} \item Interactive restore - A small shell like interface to selectively restore files \overlay{4} \item Non-interactive restore - Restore files without asking. \overlay{5} \item List mode - List contents of a backup file \overlay{6} \item Selective restore - Restore files listed on the command line \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{Restore Usage Example} This is the sequence for a \texttt{dump}---disaster---\texttt{restore} cycle: \begin{itemize} \overlay{1} \item Make a backup:\\ \rootcmd{dump -0u -f /root/boot.backup /boot} \overlay{2} \item Disk dies or some other catastrophe .... \overlay{3} \item Disaster recovery: \begin{alltt} \rootcmd{mke2fs /dev/hda1} \rootcmd{mount /dev/hda1 /mnt} \rootcmd{cd /mnt} \rootcmd{restore -r -f /root/boot.backup} \end{alltt} \end{itemize} \overlay{4} (As much as I have faith in the restore command, your not going to see a real live example!!) \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Geoffrey Robertson \slidesubsubheading{Dump and Restore Demonstration} This is the sequence for a \texttt{dump}---disaster---\texttt{restore} cycle: \begin{itemize} \overlay{1} \item Make a backup:\\ \rootcmd{dump -0 -f /root/boot.backup /boot} \overlay{2} \item Disk dies or some other catastrophe .... \overlay{3} \item Disaster recovery: \begin{alltt} \rootcmd{cd /} \rootcmd{restore -r -f /root/boot.backup} \end{alltt} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== % \begin{slide} %Andrew Eager % \slidesubsubheading{CPIO - CoPy In and Out} % \texttt{cpio} is a utility that copies files in to or out of an % archive. % The archive can exist on the local machine or on a network, % in which case the file is refered to in the same manner as the scp % command (\texttt{user@host:filename}). % There are 3 fundamental modes of operation: % \begin{description} % \item[\opt{cpio \{-o | --create\}}] - To create an archive % \item[\opt{cpio \{-i | --extract\}}] - To restore from an archive % \item[\opt{cpio \{-p | --pass-throuh\}}] - To replicate one directory % tree to another % \end{description} % \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{CPIO - file formats} The archive file can be stored in any of the following formats: \begin{itemize} \item binary (obsolete due to lack of portability) \item old ASCII or new ASCII \item crc \item HPUX binary or HPUX old ASCII \item old tar or POSIX.1 tar \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{CPIO - Copy Out (Create) Usage} \begin{verbatim} cpio -o [options] < filenames_to_archive [> archive file] \end{verbatim} \begin{itemize} \item The \texttt{-o} option can be replaced with the long \texttt{--create} option \item Output will be sent to stdout unless the \texttt{-F \textless file\textgreater} option is used \item The list of files to archive must come from stdin \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{CPIO - Copy In (Extract) Usage} \begin{alltt} cpio -i [options] [file_patterns_to_restore] [< archive file] \end{alltt} \begin{itemize} \item The \texttt{-i} option can be replaced with the long \texttt{--extract} option \item The input archive will come from stdin unless the \texttt{-F \textless file\textgreater} option is used \item If no restore file pattern is given, all files will be restored \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{CPIO - Copy Pass Usage} \begin{alltt} cpio -p [options] destination_directory < filenames_to_copy \end{alltt} \begin{itemize} \item The \texttt{-p} option can be replaced with the long \texttt{--pass-through} option \item The destination directory is mandatory \item The list of files to copy must come from stdin \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{Options to \texttt{cpio} (for LPIC purposes)} \begin{description} \overlay{1} \item[\opt{-a}] Reset access time on files (as if they hadn't been read by cpio) \overlay{2} \item[\opt{-A}] Used to append to an archive (in copy-out mode) \overlay{3} \item[\opt{--block-size N}] Set the block size to N * 512 bytes \overlay{4} \item[\opt{-d}] Create leading directories \overlay{5} \item[\opt{-E \textless file\textgreater}] Read file for additional file patterns to restore (copy-in mode) \overlay{6} \item[\opt{-f}] Copy files that don't match specified patterns \overlay{7} \item[\opt{-F \textless file\textgreater}] Specify an archive filename rather than \textsf{stdin} or \textsf{stdout} \overlay{8} \item[\opt{-0} (zero)] Filenames are terminated by null instead of newline (copy-out \& copy-pass) \overlay{9} \item[\opt{-r}] Allows files to be renamed interactively %\overlay{9} \item[\opt{-u}] Replace files without asking %\overlay{9} \item [\opt{-v}] Verbosely list files that are processed \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{CPIO - Examples} \begin{itemize} \overlay{1} \item Create a fully qualified list of filenames under \texttt{/boot}: \begin{alltt} \rootcmd{find /boot > list} \end{alltt} \overlay{2} \item Make an archive of \texttt{/boot} called \texttt{boot.backup} using default bin format: \begin{alltt} \rootcmd{cpio -o -F boot.backup -v < list} \end{alltt} \overlay{3} \item Make an archive of \texttt{/boot} called \texttt{boot.backup} using new tar format \begin{alltt} \rootcmd{cpio -o -F boot.backup -H ustar -v < list} \end{alltt} \overlay{4} \item Use tar to list the contents of the \texttt{boot.backup} tar archive \begin{alltt} \rootcmd{tar -tvf boot.backup} \end{alltt} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Andrew Eager \slidesubsubheading{CPIO - Examples} \begin{itemize} \overlay{1} \item List the contents of the \texttt{boot.backup} archive \begin{alltt} \rootcmd{cpio -i -F boot.backup --list} \end{alltt} \overlay{2} \item Restore all files in \texttt{boot.backup} to original locations \begin{alltt} \rootcmd{cpio -i -F boot.backup} \end{alltt} \overlay{3} \item Restore all files in under \texttt{/boot/grub} in \texttt{boot.backup} to original locations \begin{alltt} \rootcmd{cpio -i -F boot.backup /boot/grub/*} \end{alltt} \overlay{4} \item Make a replica of \texttt{/boot} under \texttt{/root/boot} \begin{alltt} \rootcmd{cpio -p /root pe remote refid ... delay offset jitter =========================================================== localhost.local 0.0.0.0 ... 0.000 0.000 4000.00 xmurgon.cs.mu.OZ .GPS. ... 526.202 -206.43 208.270 +apphys16.mst.cs .ATOM. ... 169.956 -5.576 87.828 *tictoc.tip.CSIR .ATOM. ... 149.988 -24.328 6.761 ntpq> q # \end{alltt} \normalsize \vfill \end{slide} %--------------------- %============================================================================== %============================================================================== %============================================================================== %============================================================================== %============================================================================== %============================================================================== \begin{slide} \slidesubheading{Using CVS To Get The Class Notes} \begin{itemize} \item I don't think you have to login to anonymous servers. You may need to the first time? If you do: \end{itemize} \small \begin{alltt} cvs -d:pserver:anonymous@cvs.lcdp.sourceforge.net:/cvsroot/lcdp login \end{alltt} \normalsize \begin{itemize} \item Change to your working directory, e.g. ~/tech/ \item Run the checkout command, specifying the name of the package: \end{itemize} \small \begin{alltt} cvs -d:pserver:anonymous@cvs.lcdp.sourceforge.net:/cvsroot/lcdp co lpic \end{alltt} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubheading{checkout output} \small \begin{alltt} cvs -d:pserver:anonymous@cvs.lcdp.sourceforge.net:/cvsroot/lcdp co lpic \end{alltt} \normalsize The output looks like this: \begin{alltt} cvs server: Updating lpic cvs server: Updating lpic/general-linux-1 U lpic/general-linux-1/notes.tex U lpic/general-linux-1/slides.tex cvs server: Updating lpic/general-linux-1/images U lpic/general-linux-1/images/links2.fig U lpic/general-linux-1/images/links2.fig.eps U lpic/general-linux-1/images/links3.fig U lpic/general-linux-1/images/links3.fig.eps U lpic/general-linux-1/images/links4.fig U lpic/general-linux-1/images/links4.fig.eps \end{alltt} CVS will create the lpic directory for you. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubheading{ Process the files} To Process the files you can: \begin{itemize} \item Convert them to html using latex2html, works ok for the notes but mangles the slides. \item Create dvi files using latex. You can then view the dvi files with xdvi. \item Generate postscript from the dvi files: \begin{alltt} dvips notes.dvi -o notes.ps dvips slides.dvi -o slides.ps \end{alltt} Then view with gv. \item Generate pdf from dvi with dvipdf. Looks good in acroread, ugly in xpdf. \end{itemize} Best results on my system are using gv with the ps files. You may get different results depending on your program versions, installed fonts and the phase of the moon. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubheading{ To Update} Change into the lpic directory, use the update command, don't specify the package. \small \begin{alltt} cvs -d:pserver:anonymous@cvs.lcdp.sourceforge.net:/cvsroot/lcdp update \end{alltt} The output will indicate the status of files as follows: \begin{description} \item[U] File created or updated from the source repository, that has not been modified locally. \item[A] File exists locally, but not on the repository, will be added to repository if a commit is done. It's just a reminder. \item[R] File has been removed locally and will be removed from the repository if you commit. Another reminder. \item[M]File has been modified locally and either: the repository file has not changed in which case your file will not have changed, or the file has also changed on the server and has been successfully merged with your changes. \item[C] A conflict has occurred between changes you have made to the file and changes on the repository ( when changes have been made to the same bit of code? ). The local file will be replaced with the one on the server and your file will be renamed to: .\#file.version. \item[?] File exists on the local working directory but not in the source repository. \end{description} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubheading{Mozilla users beware:} Mozilla users beware: when doing a cut and paste of the commands from Geoffrey's page Mozilla may insert a hash and a space "\# " at the beginning of the command when you paste into the command line (or emacs or gvim...). Doesn't happen when copying from the sourceforge page or when using Konqueror or Netscape 4.xx. Seems to be a bug in Mozilla relating to the html tags that Geoffrey is using. \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Geoffrey Robertson \slidesubheading{CVS References} Reference: \\ \verb+http://sourceforge.net/docman/?group_id=1+ CVS Instructions\\ SourceForge CVS HOWTO (UNIX platforms) \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} %Geoffrey Robertson \slidesubsubheading{Adding a CVS root directory} \begin{itemize} \item On your local machine, change to the directory whose files (and subdirectories) you want to import. Everything now in the current directory and all subdirectories will be imported into the tree. \item Type the following, where loginname is your SourceForge login name, yourproject is the unix group name of your project, and directoryname is the name of the new CVS root level directory. \texttt{cvs -d:ext:loginname@cvs.yourproject.sourceforge.net: /cvsroot/yourproject import directoryname vendor start} \item Example: \begin{alltt} \cmd{cd foo} \$ cvs -d:ext:geoff@cvs.lcdp.sourceforge.net:/cvsroot/lcdp import -m 'Initial Imprort to CVS' foo vendor start \cmd{cd ..} \cmd{mv foo foo.old} \cmd{cvs checkout foo} \end{alltt} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{CVS check out source via SSH} \begin{itemize} \item Type the following, making necessary obvious substitutions for your username and project. \texttt{cvs -d:ext:loginname@cvs.yourproject.sourceforge.net: /cvsroot/yourproject co directoryname} \item After initial checkout, you can change into this directory and execute cvs commands without the -d tag. For example: \begin{alltt} \cmd{cvs update} \cmd{cvs -d update} #update new directories \cmd{cvs -j update} #join (merge) \cmd{cvs commit -m "comments for this commit"} \cmd{cvs add myfile.c} \cmd{cvs commit myfile.c} \cmd{cvs add mydir} \cmd{cvs commit mydir} \end{alltt} \end{itemize} \normalsize \vfill \end{slide} %--------------------------------------- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \end{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %============================================================================== \begin{slide} {\huge } \hrule \vspace{3mm} \vfill \end{slide} %------------------------------------------------------------------------------ %============================================================================== %============================================================================== \begin{slide} \slidesubheading{} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{} \normalsize \vfill \end{slide} %--------------------------------------- %============================================================================== \begin{slide} \slidesubsubheading{} \begin{itemize} \begin{overlay}{1} \item s \end{overlay} \begin{overlay}{2} \item s \end{overlay} \begin{overlay}{3} \item s \begin{alltt} \end{alltt} \end{overlay} \begin{overlay}{4} \item s \end{overlay} \begin{overlay}{5} \item s \end{overlay} \end{itemize} \normalsize \vfill \end{slide} %---------------------------------------