575 lines
7.7 KiB
HTML
575 lines
7.7 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
|
<HTML
|
||
|
><HEAD
|
||
|
><TITLE
|
||
|
>Exercises</TITLE
|
||
|
><META
|
||
|
NAME="GENERATOR"
|
||
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
||
|
REL="HOME"
|
||
|
TITLE="Introduction to Linux"
|
||
|
HREF="index.html"><LINK
|
||
|
REL="UP"
|
||
|
TITLE="Quickstart"
|
||
|
HREF="chap_02.html"><LINK
|
||
|
REL="PREVIOUS"
|
||
|
TITLE="Summary"
|
||
|
HREF="sect_02_04.html"><LINK
|
||
|
REL="NEXT"
|
||
|
TITLE="About files and the file system"
|
||
|
HREF="chap_03.html"></HEAD
|
||
|
><BODY
|
||
|
CLASS="sect1"
|
||
|
BGCOLOR="#FFFFFF"
|
||
|
TEXT="#000000"
|
||
|
LINK="#0000FF"
|
||
|
VLINK="#840084"
|
||
|
ALINK="#0000FF"
|
||
|
><DIV
|
||
|
CLASS="NAVHEADER"
|
||
|
><TABLE
|
||
|
SUMMARY="Header navigation table"
|
||
|
WIDTH="100%"
|
||
|
BORDER="0"
|
||
|
CELLPADDING="0"
|
||
|
CELLSPACING="0"
|
||
|
><TR
|
||
|
><TH
|
||
|
COLSPAN="3"
|
||
|
ALIGN="center"
|
||
|
>Introduction to Linux: </TH
|
||
|
></TR
|
||
|
><TR
|
||
|
><TD
|
||
|
WIDTH="10%"
|
||
|
ALIGN="left"
|
||
|
VALIGN="bottom"
|
||
|
><A
|
||
|
HREF="sect_02_04.html"
|
||
|
ACCESSKEY="P"
|
||
|
>Prev</A
|
||
|
></TD
|
||
|
><TD
|
||
|
WIDTH="80%"
|
||
|
ALIGN="center"
|
||
|
VALIGN="bottom"
|
||
|
>Chapter 2. Quickstart</TD
|
||
|
><TD
|
||
|
WIDTH="10%"
|
||
|
ALIGN="right"
|
||
|
VALIGN="bottom"
|
||
|
><A
|
||
|
HREF="chap_03.html"
|
||
|
ACCESSKEY="N"
|
||
|
>Next</A
|
||
|
></TD
|
||
|
></TR
|
||
|
></TABLE
|
||
|
><HR
|
||
|
ALIGN="LEFT"
|
||
|
WIDTH="100%"></DIV
|
||
|
><DIV
|
||
|
CLASS="sect1"
|
||
|
><H1
|
||
|
CLASS="sect1"
|
||
|
><A
|
||
|
NAME="sect_02_05"
|
||
|
></A
|
||
|
>2.5. Exercises</H1
|
||
|
><P
|
||
|
>Most of what we learn is by making mistakes and by seeing how things can go wrong. These exercises are made to get you to read some error messages. The order in which you do these exercises is important.</P
|
||
|
><P
|
||
|
>Don't forget to use the Bash features on the command line: try to do the exercises typing as few characters as possible!</P
|
||
|
><DIV
|
||
|
CLASS="sect2"
|
||
|
><H2
|
||
|
CLASS="sect2"
|
||
|
><A
|
||
|
NAME="sect_02_05_01"
|
||
|
></A
|
||
|
>2.5.1. Connecting and disconnecting</H2
|
||
|
><P
|
||
|
> <P
|
||
|
></P
|
||
|
><UL
|
||
|
><LI
|
||
|
><P
|
||
|
>Determine whether you are working in text or in graphical mode.</P
|
||
|
><P
|
||
|
>I am working in text/graphical mode. (cross out what's not applicable)</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Log in with the user name and password you made for yourself during the installation.</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Log out.</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Log in again, using a non-existent user name</P
|
||
|
><P
|
||
|
>-> What happens?</P
|
||
|
></LI
|
||
|
></UL
|
||
|
>
|
||
|
</P
|
||
|
></DIV
|
||
|
><DIV
|
||
|
CLASS="sect2"
|
||
|
><H2
|
||
|
CLASS="sect2"
|
||
|
><A
|
||
|
NAME="sect_02_05_02"
|
||
|
></A
|
||
|
>2.5.2. Passwords</H2
|
||
|
><P
|
||
|
>Log in again with your user name and password.</P
|
||
|
><P
|
||
|
></P
|
||
|
><UL
|
||
|
><LI
|
||
|
><P
|
||
|
>Change your password into <EM
|
||
|
>P6p3.aa!</EM
|
||
|
> and hit the <B
|
||
|
CLASS="keycap"
|
||
|
>Enter</B
|
||
|
> key.</P
|
||
|
><P
|
||
|
>-> What happens?</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Try again, this time enter a password that is ridiculously easy, like <EM
|
||
|
>123</EM
|
||
|
> or <EM
|
||
|
>aaa</EM
|
||
|
>.</P
|
||
|
><P
|
||
|
>-> What happens?</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Try again, this time don't enter a password but just hit the <B
|
||
|
CLASS="keycap"
|
||
|
>Enter</B
|
||
|
> key.</P
|
||
|
><P
|
||
|
>-> What happens?</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Try the command <B
|
||
|
CLASS="command"
|
||
|
>psswd</B
|
||
|
> instead of <B
|
||
|
CLASS="command"
|
||
|
>passwd</B
|
||
|
></P
|
||
|
><P
|
||
|
>-> What happens?</P
|
||
|
></LI
|
||
|
></UL
|
||
|
><DIV
|
||
|
CLASS="warning"
|
||
|
><P
|
||
|
></P
|
||
|
><TABLE
|
||
|
CLASS="warning"
|
||
|
WIDTH="100%"
|
||
|
BORDER="0"
|
||
|
><TR
|
||
|
><TD
|
||
|
WIDTH="25"
|
||
|
ALIGN="CENTER"
|
||
|
VALIGN="TOP"
|
||
|
><IMG
|
||
|
SRC="../images/warning.gif"
|
||
|
HSPACE="5"
|
||
|
ALT="Warning"></TD
|
||
|
><TH
|
||
|
ALIGN="LEFT"
|
||
|
VALIGN="CENTER"
|
||
|
><B
|
||
|
>New password</B
|
||
|
></TH
|
||
|
></TR
|
||
|
><TR
|
||
|
><TD
|
||
|
> </TD
|
||
|
><TD
|
||
|
ALIGN="LEFT"
|
||
|
VALIGN="TOP"
|
||
|
><P
|
||
|
>Unless you change your password back again to what it was before this exercise, it will be <SPAN
|
||
|
CLASS="QUOTE"
|
||
|
>"P6p3.aa!"</SPAN
|
||
|
>. Change your password after this exercise!</P
|
||
|
><P
|
||
|
>Note that some systems might not allow to recycle passwords, i.e. restore the original one within a certain amount of time or a certain amount of password changes, or both.</P
|
||
|
></TD
|
||
|
></TR
|
||
|
></TABLE
|
||
|
></DIV
|
||
|
></DIV
|
||
|
><DIV
|
||
|
CLASS="sect2"
|
||
|
><H2
|
||
|
CLASS="sect2"
|
||
|
><A
|
||
|
NAME="sect_02_05_03"
|
||
|
></A
|
||
|
>2.5.3. Directories</H2
|
||
|
><P
|
||
|
>These are some exercises to help you get the feel.</P
|
||
|
><P
|
||
|
></P
|
||
|
><UL
|
||
|
><LI
|
||
|
><P
|
||
|
>Enter the command <B
|
||
|
CLASS="command"
|
||
|
>cd <TT
|
||
|
CLASS="filename"
|
||
|
>blah</TT
|
||
|
></B
|
||
|
></P
|
||
|
><P
|
||
|
>-> What happens?</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Enter the command <B
|
||
|
CLASS="command"
|
||
|
>cd <TT
|
||
|
CLASS="filename"
|
||
|
>..</TT
|
||
|
></B
|
||
|
></P
|
||
|
><P
|
||
|
>Mind the space between "cd" and ".."! Use the <B
|
||
|
CLASS="command"
|
||
|
>pwd</B
|
||
|
> command.</P
|
||
|
><P
|
||
|
>-> What happens?</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>List the directory contents with the <B
|
||
|
CLASS="command"
|
||
|
>ls</B
|
||
|
> command.</P
|
||
|
><P
|
||
|
>-> What do you see?</P
|
||
|
><P
|
||
|
>-> What do you think these are?</P
|
||
|
><P
|
||
|
>-> Check using the <B
|
||
|
CLASS="command"
|
||
|
>pwd</B
|
||
|
> command.</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Enter the <B
|
||
|
CLASS="command"
|
||
|
>cd</B
|
||
|
> command.</P
|
||
|
><P
|
||
|
>-> What happens?</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Repeat step 2 two times.</P
|
||
|
><P
|
||
|
>-> What happens?</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Display the content of this directory.</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Try the command <B
|
||
|
CLASS="command"
|
||
|
>cd <TT
|
||
|
CLASS="filename"
|
||
|
>root</TT
|
||
|
></B
|
||
|
></P
|
||
|
><P
|
||
|
>-> What happens?</P
|
||
|
><P
|
||
|
>-> To which directories do you have access?</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Repeat step 4.</P
|
||
|
><P
|
||
|
>Do you know another possibility to get where you are now?</P
|
||
|
></LI
|
||
|
></UL
|
||
|
></DIV
|
||
|
><DIV
|
||
|
CLASS="sect2"
|
||
|
><H2
|
||
|
CLASS="sect2"
|
||
|
><A
|
||
|
NAME="sect_02_05_04"
|
||
|
></A
|
||
|
>2.5.4. Files</H2
|
||
|
><P
|
||
|
></P
|
||
|
><UL
|
||
|
><LI
|
||
|
><P
|
||
|
>Change directory to <TT
|
||
|
CLASS="filename"
|
||
|
>/</TT
|
||
|
> and then to <TT
|
||
|
CLASS="filename"
|
||
|
>etc</TT
|
||
|
>. Type <B
|
||
|
CLASS="command"
|
||
|
>ls</B
|
||
|
>; if the output is longer than your screen, make the window longer, or try <B
|
||
|
CLASS="keycap"
|
||
|
>Shift</B
|
||
|
>+<B
|
||
|
CLASS="keycap"
|
||
|
>PageUp</B
|
||
|
> and <B
|
||
|
CLASS="keycap"
|
||
|
>Shift</B
|
||
|
>+<B
|
||
|
CLASS="keycap"
|
||
|
>PageDown</B
|
||
|
>.</P
|
||
|
><P
|
||
|
>The file <TT
|
||
|
CLASS="filename"
|
||
|
>inittab</TT
|
||
|
> contains the answer to the first question in this list. Try the <B
|
||
|
CLASS="command"
|
||
|
>file</B
|
||
|
> command on it.</P
|
||
|
><P
|
||
|
>-> The file type of my <TT
|
||
|
CLASS="filename"
|
||
|
>inittab</TT
|
||
|
> is .....</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Use the command <B
|
||
|
CLASS="command"
|
||
|
>cat <TT
|
||
|
CLASS="filename"
|
||
|
>inittab</TT
|
||
|
></B
|
||
|
> and read the file.</P
|
||
|
><P
|
||
|
>-> What is the default mode of your computer?</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Return to your home directory using the <B
|
||
|
CLASS="command"
|
||
|
>cd</B
|
||
|
> command.</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Enter the command <B
|
||
|
CLASS="command"
|
||
|
>file <TT
|
||
|
CLASS="filename"
|
||
|
>.</TT
|
||
|
></B
|
||
|
></P
|
||
|
><P
|
||
|
>-> Does this help to find the meaning of <SPAN
|
||
|
CLASS="QUOTE"
|
||
|
>"."</SPAN
|
||
|
>? </P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Can you look at "." using the <B
|
||
|
CLASS="command"
|
||
|
>cat</B
|
||
|
> command?</P
|
||
|
><P
|
||
|
></P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Display help for the <B
|
||
|
CLASS="command"
|
||
|
>cat</B
|
||
|
> program, using the <TT
|
||
|
CLASS="option"
|
||
|
>--help</TT
|
||
|
> option. Use the option for numbering of output lines to count how many users are listed in the file <TT
|
||
|
CLASS="filename"
|
||
|
>/etc/passwd</TT
|
||
|
>.</P
|
||
|
></LI
|
||
|
></UL
|
||
|
></DIV
|
||
|
><DIV
|
||
|
CLASS="sect2"
|
||
|
><H2
|
||
|
CLASS="sect2"
|
||
|
><A
|
||
|
NAME="sect_02_05_05"
|
||
|
></A
|
||
|
>2.5.5. Getting help</H2
|
||
|
><P
|
||
|
></P
|
||
|
><UL
|
||
|
><LI
|
||
|
><P
|
||
|
>Read <B
|
||
|
CLASS="command"
|
||
|
>man <TT
|
||
|
CLASS="parameter"
|
||
|
><I
|
||
|
>intro</I
|
||
|
></TT
|
||
|
></B
|
||
|
></P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Read <B
|
||
|
CLASS="command"
|
||
|
>man <TT
|
||
|
CLASS="parameter"
|
||
|
><I
|
||
|
>ls</I
|
||
|
></TT
|
||
|
></B
|
||
|
></P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Read <B
|
||
|
CLASS="command"
|
||
|
>info <TT
|
||
|
CLASS="parameter"
|
||
|
><I
|
||
|
>passwd</I
|
||
|
></TT
|
||
|
></B
|
||
|
></P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Enter the <B
|
||
|
CLASS="command"
|
||
|
>apropos <TT
|
||
|
CLASS="option"
|
||
|
>pwd</TT
|
||
|
></B
|
||
|
> command.</P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Try <B
|
||
|
CLASS="command"
|
||
|
>man</B
|
||
|
> or <B
|
||
|
CLASS="command"
|
||
|
>info</B
|
||
|
> on <B
|
||
|
CLASS="command"
|
||
|
>cd</B
|
||
|
>.</P
|
||
|
><P
|
||
|
>-> How would you find out more about <B
|
||
|
CLASS="command"
|
||
|
>cd</B
|
||
|
>? </P
|
||
|
></LI
|
||
|
><LI
|
||
|
><P
|
||
|
>Read <B
|
||
|
CLASS="command"
|
||
|
>ls <TT
|
||
|
CLASS="option"
|
||
|
>--help</TT
|
||
|
></B
|
||
|
> and try it out.</P
|
||
|
></LI
|
||
|
></UL
|
||
|
></DIV
|
||
|
></DIV
|
||
|
><DIV
|
||
|
CLASS="NAVFOOTER"
|
||
|
><HR
|
||
|
ALIGN="LEFT"
|
||
|
WIDTH="100%"><TABLE
|
||
|
SUMMARY="Footer navigation table"
|
||
|
WIDTH="100%"
|
||
|
BORDER="0"
|
||
|
CELLPADDING="0"
|
||
|
CELLSPACING="0"
|
||
|
><TR
|
||
|
><TD
|
||
|
WIDTH="33%"
|
||
|
ALIGN="left"
|
||
|
VALIGN="top"
|
||
|
><A
|
||
|
HREF="sect_02_04.html"
|
||
|
ACCESSKEY="P"
|
||
|
>Prev</A
|
||
|
></TD
|
||
|
><TD
|
||
|
WIDTH="34%"
|
||
|
ALIGN="center"
|
||
|
VALIGN="top"
|
||
|
><A
|
||
|
HREF="index.html"
|
||
|
ACCESSKEY="H"
|
||
|
>Home</A
|
||
|
></TD
|
||
|
><TD
|
||
|
WIDTH="33%"
|
||
|
ALIGN="right"
|
||
|
VALIGN="top"
|
||
|
><A
|
||
|
HREF="chap_03.html"
|
||
|
ACCESSKEY="N"
|
||
|
>Next</A
|
||
|
></TD
|
||
|
></TR
|
||
|
><TR
|
||
|
><TD
|
||
|
WIDTH="33%"
|
||
|
ALIGN="left"
|
||
|
VALIGN="top"
|
||
|
>Summary</TD
|
||
|
><TD
|
||
|
WIDTH="34%"
|
||
|
ALIGN="center"
|
||
|
VALIGN="top"
|
||
|
><A
|
||
|
HREF="chap_02.html"
|
||
|
ACCESSKEY="U"
|
||
|
>Up</A
|
||
|
></TD
|
||
|
><TD
|
||
|
WIDTH="33%"
|
||
|
ALIGN="right"
|
||
|
VALIGN="top"
|
||
|
>About files and the file system</TD
|
||
|
></TR
|
||
|
></TABLE
|
||
|
></DIV
|
||
|
></BODY
|
||
|
></HTML
|
||
|
>
|