1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 99.2beta8 (1.46)
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>2. Computing Sub-basics</TITLE>
<META NAME="description" CONTENT="2. Computing Sub-basics">
<META NAME="keywords" CONTENT="rute">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="LaTeX2HTML v99.2beta8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="rute.css">
<LINK REL="next" HREF="node6.html">
<LINK REL="previous" HREF="node4.html">
<LINK REL="up" HREF="rute.html">
<LINK REL="next" HREF="node6.html">
</HEAD>
<BODY BGCOLOR=#FFFFFF >
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
<TR><TD align=left bgcolor="#000000">
<FONT COLOR=white>
<A HREF="http://www.icon.co.za/~psheer/rute-purchase.html"><FONT COLOR=white>Purchase</FONT></A>
</FONT>
</TD><TD align=center bgcolor="#000000">
<FONT COLOR=white>
Copyright © 2002 Paul Sheer. <A HREF="copying.html"><FONT COLOR=white>Click here for copying permissions.</FONT></A>
</FONT>
</TD><TD align=right bgcolor="#000000">
<FONT COLOR=white>
<A HREF="http://www.icon.co.za/~psheer/rute-home.html"><FONT COLOR=white>Home</FONT></A>
</FONT>
</TD></TR>
<TR><TD colspan=2 align=left bgcolor="#ECEBF4">
<IMG SRC="va-btn-small-light-60.png">
</TD><TD align=right bgcolor="#ECEBF4">
<IMG SRC="sflogo2-steel-60.png">
</TD></TR>
</TABLE><BR>
<!--Navigation Panel-->
<A NAME="tex2html1743"
HREF="node6.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
<A NAME="tex2html1739"
HREF="rute.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
<A NAME="tex2html1733"
HREF="node4.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
<A NAME="tex2html1741"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1744"
HREF="node6.html">3. PC Hardware</A>
<B> Up:</B> <A NAME="tex2html1740"
HREF="rute.html">rute</A>
<B> Previous:</B> <A NAME="tex2html1734"
HREF="node4.html">1. Introduction</A>
  <B> <A NAME="tex2html1742"
HREF="node1.html">Contents</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
<UL>
<LI><A NAME="tex2html1745"
HREF="#SECTION00510000000000000000">2.1 Binary, Octal, Decimal, and Hexadecimal</A>
<LI><A NAME="tex2html1746"
HREF="#SECTION00520000000000000000">2.2 Files</A>
<LI><A NAME="tex2html1747"
HREF="#SECTION00530000000000000000">2.3 Commands</A>
<LI><A NAME="tex2html1748"
HREF="#SECTION00540000000000000000">2.4 Login and Password Change</A>
<LI><A NAME="tex2html1749"
HREF="#SECTION00550000000000000000">2.5 Listing Files</A>
<LI><A NAME="tex2html1750"
HREF="#SECTION00560000000000000000">2.6 Command-Line Editing Keys</A>
<LI><A NAME="tex2html1751"
HREF="#SECTION00570000000000000000">2.7 Console Keys</A>
<LI><A NAME="tex2html1752"
HREF="#SECTION00580000000000000000">2.8 Creating Files</A>
<LI><A NAME="tex2html1753"
HREF="#SECTION00590000000000000000">2.9 Allowable Characters for File Names</A>
<LI><A NAME="tex2html1754"
HREF="#SECTION005100000000000000000">2.10 Directories</A>
</UL>
<!--End of Table of Child-Links-->
<HR>
<H1><A NAME="SECTION00500000000000000000">
2. Computing Sub-basics</A>
</H1>
<P>
<A NAME="chap:compsubbasics"></A>
<P>
This chapter explains some basics that most computer users
will already be familiar with. If you are new to U<SMALL>NIX</SMALL>, however, you
may want to gloss over the commonly used key bindings for reference.
<P>
The best way of thinking about how a computer stores and manages information
is to ask yourself how <I>you</I> would. Most often the way a computer works
is exactly the way you would expect it to if you were inventing it for the first
time. The only limitations on this are those imposed by logical feasibility and
imagination, but almost anything else is allowed.
<P>
<H1><A NAME="SECTION00510000000000000000">
2.1 Binary, Octal, Decimal, and Hexadecimal</A>
</H1>
<P>
<A NAME="sec:binocthex"></A>
<P>
When you first learned to count, you did so with 10 digits. Ordinary
numbers (like telephone numbers) are called ``base ten'' numbers. Postal codes
that include letters <I>and</I> digits are called ``base 36'' numbers because
of the addition of 26 letters onto the usual 10 digits. The simplest
base possible is ``base two'' which uses only two digits: 0 and 1. Now, a 7-digit
telephone number has
<!-- MATH
$\underbrace{10\times{}10\times{}10\times{}10\times{}10\times{}10\times{}10}_{7{~}digits}{}={}10^7{}={}10,000,000$
-->
<IMG
WIDTH="378" HEIGHT="61" ALIGN="MIDDLE" BORDER="0"
SRC="img2.png"
ALT="$\underbrace{10\times{}10\times{}10\times{}10\times{}10\times{}10\times{}10}_{7{~}digits}{}={}10^7{}={}10,000,000$">
possible combinations. A postal code with
four characters has <!-- MATH
$36^4{}={}1,679,616$
-->
<IMG
WIDTH="118" HEIGHT="33" ALIGN="MIDDLE" BORDER="0"
SRC="img3.png"
ALT="$36^4{}={}1,679,616$"> possible combinations. However, an 8-digit
binary number only has <IMG
WIDTH="64" HEIGHT="17" ALIGN="BOTTOM" BORDER="0"
SRC="img4.png"
ALT="$2^8{}={}256$"> possible combinations.
<P>
Since the internal representation of numbers within a computer is binary
and since it is rather tedious to convert between decimal and binary,
computer scientists have come up with new bases to represent numbers:
these are ``base sixteen'' and ``base eight,'' known as <I>hexadecimal</I> and
<I>octal</I>, respectively. Hexadecimal numbers use the digits 0 through 9 and
the letters A through F, whereas octal numbers use only the digits 0 through 7.
Hexadecimal is often abbreviated as <I>hex</I>.
<P>
Consider a 4-digit binary number. It has <IMG
WIDTH="56" HEIGHT="17" ALIGN="BOTTOM" BORDER="0"
SRC="img5.png"
ALT="$2^4{}={}16$"> possible combinations
and can therefore be easily represented by one of the 16 hex
digits. A 3-digit binary number has <IMG
WIDTH="48" HEIGHT="17" ALIGN="BOTTOM" BORDER="0"
SRC="img6.png"
ALT="$2^3{}={}8$"> possible combinations and can
thus be represented by a single octal digit. Hence, a binary
number can be represented with hex or octal digits without much
calculation, as shown in Table <A HREF="node5.html#table:binhex">2.1</A>.
<A NAME="table:binhex"></A><IMG
WIDTH="386" HEIGHT="379" ALIGN="BOTTOM" BORDER="0"
SRC="img7.png"
ALT="\begin{table}[!h]
\begin{center}
\caption{Binary hexadecimal, and octal represen...
... \\
1101 & D \\
1110 & E \\
1111 & F \\
\end{tabular}\end{center}\end{table}">
<BR>
<P>
A binary number 01001011 can be represented in hex as 4B and in octal as 113 by simply
separating the binary digits into groups of four or three, respectively.
<P>
In U<SMALL>NIX</SMALL> administration,
and also in many programming languages, there is often the
ambiguity of whether a number is in fact a hex, decimal, or octal number. For instance,
a hex number 56 is 01010110, but an octal number 56 is 101110, whereas
a decimal number 56 is 111000 (computed through a more tedious calculation).
To distinguish between them, hex numbers are often prefixed with the characters
``0x'', while octal numbers are prefixed with a ``0''. If the first digit
is 1 through 9, then it is a decimal number that is probably being referred
to. We would then write 0x56 for hex, and 056 for octal. Another representation is
to append the letter H, D, O, or B (or h, d, o, b)
to the number to indicate its base.
<P>
U<SMALL>NIX</SMALL> makes heavy use of 8-, 16-, and 32-digit binary numbers, often representing
them as 2-, 4-, and 8-digit hex numbers. You should get used to seeing numbers like
0xffff (or FFFFh), which in decimal is 65535 and in binary is 1111111111111111.
<P>
<H1><A NAME="SECTION00520000000000000000">
2.2 Files</A>
</H1>
<P>
Common to every computer system invented is the <I>file</I>. A file holds a
single contiguous block of data. Any kind of data can be stored in a file, and
there is no data that cannot be stored in a file. Furthermore, there is no kind
of data that is stored anywhere else except in files. A file holds data of
the same type, for instance, a single picture will be stored in one file. During
production, this book had each chapter stored in a file. It is uncommon
for different types of data (say, text and pictures) to be stored together in the
same file because it is inconvenient. A computer will typically contain about 10,000
files that have a great many purposes. Each file will have its own name. The file
name on a L<SMALL>INUX</SMALL> or U<SMALL>NIX</SMALL> machine can
be up to 256 characters long.
<P>
The file name is usually explanatory--you
might call a letter you wrote to your friend something like <TT>
<FONT COLOR="#0000ff">Mary_Jones.letter</FONT></TT>
(from now on, whenever you see the typewriter font <FONT COLOR="#ffa500">[A style of print: here
is <TT>
<FONT COLOR="#0000ff">typewriter font</FONT></TT>.]</FONT>, it means that those are words that might be read off the screen
of the computer). The name you choose has no meaning to the computer and could just as well
be any other combination of letters or digits; however, you will refer to that data
with that file name whenever you give an instruction to the computer regarding
that data, so <I>you</I> would like it to be descriptive.
<FONT COLOR="#ffa500">[It is important to internalize the fact that computers do not have an interpretation for anything.
A computer operates with a set of interdependent logical rules. <I>Interdependent</I>
means that the rules have no apex, in the sense that computers have no fixed or single way of working.
For example, the reason a computer has files at all is because computer <I>programmers</I>
have decided that this is the most universal and convenient way of storing data, and if you think
about it, it really is.]</FONT>
<P>
The data in each file is merely a long list of numbers. The <I>size</I> of the
file is just the length of the list of numbers. Each number is called a <I>byte</I>.
Each byte contains 8 <I>bits</I>. Each bit is either a one or a zero and therefore, once
again, there are
<!-- MATH
$\underbrace{2\times{}2\times{}2\times{}2\times{}2\times{}2\times{}2\times{}2}_{8{~}bits}{}={}\underbrace{256}_{1{~}byte}$
-->
<IMG
WIDTH="264" HEIGHT="59" ALIGN="MIDDLE" BORDER="0"
SRC="img8.png"
ALT="$\underbrace{2\times{}2\times{}2\times{}2\times{}2\times{}2\times{}2\times{}2}_{8{~}bits}{}={}\underbrace{256}_{1{~}byte}$">
possible combinations. Hence a byte can only hold a number as large as
255. There is no type of data that cannot be represented
as a list of bytes. Bytes are sometimes also called <I>octets</I>. Your
letter to Mary will be <I>encoded</I> into bytes for
storage on the computer. We all know that a television picture
is just a sequence of dots on the screen that scan from left to right. In
that way, a picture might be represented in a file: that is, as a sequence
of bytes where each byte is interpreted as a level of brightness--0 for
black and 255 for white. For your letter, the convention is to store an <TT>
<FONT COLOR="#0000ff">A</FONT></TT>
as 65, a <TT>
<FONT COLOR="#0000ff">B</FONT></TT> as 66, and so on. Each punctuation character also has a numerical
equivalent.
<P>
A mapping between numbers and characters is called a <I>character mapping</I>
or a <I>character set</I>. The most common character set in use in the world today
is the <I>ASCII</I> character set which stands for the American Standard Code
for Information Interchange. Table <A HREF="node5.html#tab:asccicharset">2.2</A> shows the complete ASCII mappings
between characters and their hex, decimal, and octal equivalents.
<P>
<A NAME="tab:asccicharset"></A><IMG
WIDTH="576" HEIGHT="494" ALIGN="BOTTOM" BORDER="0"
SRC="img9.png"
ALT="{\scriptsize\begin{longtable}[c]{\vert l l l l \vert l l l l \vert l l l l \vert...
...5F & \texttt{\char95} & 177 & 127 & 7F & \emph{DEL} \\
\hline
\end{longtable}}">
<BR>
<P>
<H1><A NAME="SECTION00530000000000000000">
2.3 Commands</A>
</H1>
<P>
The second thing common to every computer system invented is the <I>command</I>.
You tell the computer what to do with single words typed into the
computer one at a time. Modern computers appear to have done away with the typing of
commands by having beautiful graphical displays that work with a mouse, but,
fundamentally, all that is happening is that commands are being secretly typed
in for you. Using commands is still the only way to have complete power over
the computer. You don't really know anything about a computer until you come
to grips with the commands it uses. Using a computer will very much involve
typing in a word, pressing <IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-enter.png" ALT="Enter">, and then waiting for the computer
screen to spit something back at you. Most commands are typed in to do something
useful to a file.
<P>
<H1><A NAME="SECTION00540000000000000000">
2.4 Login and Password Change</A>
</H1>
<P>
Turn on your L<SMALL>INUX</SMALL> box. After a few minutes of initialization, you will
see the <I>login prompt</I>. A <I>prompt</I>
is one or more characters displayed on the screen that you are expected to
follow with some typing of your own. Here the prompt may state the name of the computer
(each computer has a name--typically
consisting of about eight lowercase letters) and then the word <TT>
<FONT COLOR="#0000ff">login:</FONT></TT>.
L<SMALL>INUX</SMALL> machines now come
with a graphical desktop by default (most of the time),
so you might get a pretty graphical login with the same effect.
Now you should type your <I>login name</I>--a sequence of about eight lower
case letters that would have been assigned to you by your computer
administrator--and then press the <I>Enter</I> (or <I>Return</I>) key (that is, <IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-enter.png" ALT="Enter">).
<P>
A <I>password prompt</I>
will appear after which you should type your password.
Your password <I>may</I> be the same as your <I>login</I> <I>name</I>. Note
that your password will not be shown on the screen as you type it but will
be invisible. After typing your password,
press the <I>Enter</I> or <I>Return</I> key again. The screen might show some
message and prompt you for a log in again--in this case, you have probably typed
something incorrectly and should give it another try. From now on, you will
be expected to know that the <I>Enter</I> or <I>Return</I> key should be pressed at the
end of every line you type in, analogous to the mechanical typewriter. You will
also be expected to know that human error is very common; when you type something
incorrectly, the computer will give an error message, and you should try again
until you get it right. It is uncommon for a person to understand computer
concepts after a first reading or to get commands to work on the first try.
<P>
Now that you have logged in you will see a <I>shell prompt</I>--a
<I>shell</I> is the place where you can type commands.
The shell is where you will spend most of your time as a system
administrator <FONT COLOR="#ffa500">[Computer manager.]</FONT>, but it needn't look
as bland as you see now. Your first exercise is to change your
password. Type the command <TT>
<FONT COLOR="#0000ff">passwd</FONT></TT>. You will be
asked for a new password and then asked to confirm that
password. The password you choose should consist of letters,
numbers, and punctuation--you will see later on why this
security measure is a good idea. Take good note of your password
for the next time you log in. Then the shell will return.
The password you have chosen will take effect
immediately, replacing the previous password that you used to
log in. The password command might also have given some message
indicating what effect it actually had. You may not understand
the message, but you should try to get an idea of whether the
connotation was positive or negative.
<P>
When you are using a computer, it is useful to imagine yourself as <I>being</I>
in different places <I>within</I> the computer, rather than just typing commands
into it. After you entered the <TT>
<FONT COLOR="#0000ff">passwd</FONT></TT> command, you were no longer <I>in</I>
the shell, but moved <I>into</I> the password <I>place</I>. You could not use
the shell until you had moved <I>out</I> of the <TT>
<FONT COLOR="#0000ff">passwd</FONT></TT> command.
<P>
<H1><A NAME="SECTION00550000000000000000">
2.5 Listing Files</A>
</H1>
<P>
Type in the command <TT>
<FONT COLOR="#0000ff">ls</FONT></TT>. <TT>
<FONT COLOR="#0000ff">ls</FONT></TT> is short for <I>list</I>, abbreviated
to two letters like most other U<SMALL>NIX</SMALL> commands.
<TT>
<FONT COLOR="#0000ff">ls</FONT></TT> lists all your
current files. You may find that <TT>
<FONT COLOR="#0000ff">ls</FONT></TT> does nothing, but just returns
you back to the shell. This would be because you have no files as yet. Most
U<SMALL>NIX</SMALL> commands do <I>not</I> give any kind of message unless something went wrong
(the <TT>
<FONT COLOR="#0000ff">passwd</FONT></TT> command above was an exception). If there were files, you
would see their names listed rather blandly in columns with no indication of
what they are for.
<P>
<H1><A NAME="SECTION00560000000000000000">
2.6 Command-Line Editing Keys</A>
</H1>
<P>
<A NAME="sec:cmdlineeditkeys"></A>
<P>
The following keys are useful for editing the <I>command-line</I>. Note
that U<SMALL>NIX</SMALL> has had a long and twisted evolution from the mainframe,
and the <IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-home.png" ALT="Home">, <IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-end.png" ALT="End"> and other keys may not work properly.
The following keys bindings are however common throughout many L<SMALL>INUX</SMALL>
applications:
<DL>
<DT><STRONG><I>Ctrl-a</I></STRONG></DT>
<DD>Move to the beginning of the line (<IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-home.png" ALT="Home">).
</DD>
<DT><STRONG><I>Ctrl-e</I></STRONG></DT>
<DD>Move to the end of the line (<IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-end.png" ALT="End">).
</DD>
<DT><STRONG><I>Ctrl-h</I></STRONG></DT>
<DD>Erase backward (<IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-backspace.png" ALT="backspace">).
</DD>
<DT><STRONG><I>Ctrl-d</I></STRONG></DT>
<DD>Erase forward (<IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-delete.png" ALT="Delete">).
</DD>
<DT><STRONG><I>Ctrl-f</I></STRONG></DT>
<DD>Move forward one character (<IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-rightarrow.png" ALT="Right Arrow">).
</DD>
<DT><STRONG><I>Ctrl-b</I></STRONG></DT>
<DD>Move backward one character (<IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-leftarrow.png" ALT="Left Arrow">).
</DD>
<DT><STRONG><I>Alt-f</I></STRONG></DT>
<DD>Move forward one word.
</DD>
<DT><STRONG><I>Alt-b</I></STRONG></DT>
<DD>Move backward one word.
</DD>
<DT><STRONG><I>Alt-Ctrl-f</I></STRONG></DT>
<DD>Erase forward one word.
</DD>
<DT><STRONG><I>Alt-Ctrl-b</I></STRONG></DT>
<DD>Erase backward one word.
</DD>
<DT><STRONG><I>Ctrl-p</I></STRONG></DT>
<DD>Previous command (up arrow).
</DD>
<DT><STRONG><I>Ctrl-n</I></STRONG></DT>
<DD>Next command (down arrow).
</DD>
</DL>
Note that the prefixes <I>Alt</I> for <IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-alt.png" ALT="Alt">, <I>Ctrl</I> for <IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-ctrl.png" ALT="Ctrl">, and
<I>Shift</I> for <IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-shift.png" ALT="Shift">, mean to hold the key down through the pressing and
releasing of the letter key. These are known as <I>key modifiers</I>.
Note also, that the <I>Ctrl</I> key is always case insensitive; hence
<I>Ctrl-D</I> (i.e. <IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-ctrl.png" ALT="Ctrl">-<IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-shift.png" ALT="Shift">-<IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-D.png" ALT="D">) and <I>Ctrl-d</I>
(i.e. <IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-ctrl.png" ALT="Ctrl">-<IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-D.png" ALT="D">) are identical.
The <I>Alt</I> modifier (i.e., <IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-alt.png" ALT="Alt">-<FONT SIZE="+1"><I>?</I></FONT>) is in fact a
short way of pressing and releasing <IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-esc.png" ALT="Esc"> before
entering the key combination; hence <I>Esc</I> then <I>f</I> is the
same as <I>Alt-f</I>--U<SMALL>NIX</SMALL> is different from other operating
systems in this use of <I>Esc</I>. The <I>Alt</I> modifier is not case
insensitive although some applications will make a special effort to
respond insensitively. The <I>Alt</I> key is also sometimes referred
to as the <I>Meta</I> key. All of these keys are sometimes referred to
by their abbreviations: for example, <I>C-a</I> for <I>Ctrl-a</I>, or
<I>M-f</I> for <I>Meta-f</I> and <I>Alt-f</I>. The <I>Ctrl</I> modifier
is sometimes also designated with a caret: for example,
<TT>
<FONT COLOR="#0000ff">^C</FONT></TT> for <I>Ctrl-C</I>.
<P>
Your command-line keeps a history of all the commands you have typed
in. <I>Ctrl-p</I> and <I>Ctrl-n</I> will cycle through previous
commands entered. New users seem to gain tremendous satisfaction from
typing in lengthy commands over and over. <I>Never</I> type in anything
more than once--use your command history instead.
<P>
<I>Ctrl-s</I> is used to <I>s</I>uspend the current session, causing the
keyboard to stop responding. <I>Ctrl-q</I> reverses this condition.
<P>
<I>Ctrl-r</I> activates a search on your command history. Pressing
<I>Ctrl-r</I> in the middle of a search finds the next match
whereas <I>Ctrl-s</I> reverts to the previous match (although some
distributions have this confused with suspend).
<P>
The <I>Tab</I>
command is tremendously useful for saving key strokes.
Typing a partial directory name, file name, or command, and then pressing
<I>Tab</I> once or twice in sequence completes the word for you
without your having to type it all in full.
<P>
You can make <I>Tab</I> and other keys stop
beeping in the irritating way that they do by
editing the file <TT>
<FONT COLOR="#0000ff">/etc/inputrc</FONT></TT> and adding the line
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>set bell-style none</code><br>
</FONT></TD></TR></TABLE><P>
and then logging out and logging in again. (More about this later.)
<P>
<H1><A NAME="SECTION00570000000000000000">
2.7 Console Keys</A>
</H1>
<P>
<A NAME="sec:consoleswitching"></A>
<P>
There are several special keys interpreted directly by the
L<SMALL>INUX</SMALL> <I>console</I> or
text mode interface. The <I>Ctrl-Alt-Del</I> combination initiates a complete
shutdown and hardware reboot, which is the preferred method of
restarting L<SMALL>INUX</SMALL>.
<P>
The <I>Ctrl-PgUp</I> and <I>Ctrl-PgDn</I> keys scroll the console,
which is very useful for seeing text that has disappeared off the top
of the terminal.
<P>
You can use <I>Alt-F2</I> to switch to a new,
independent login session. Here you can log in again and run a separate session.
There are six of these <I>virtual consoles</I>--<I>Alt-F1</I> through
<I>Alt-F6</I>--to choose from; they are also called <I>virtual terminals</I>.
If you are in graphical mode, you will have to instead press
<I>Ctrl-Alt-F</I><I>?</I> because the <I>Alt-F</I><I>?</I>
keys are often used by applications. The convention is that the seventh
virtual console is graphical, so <I>Alt-F7</I> will always take you
back to graphical mode.
<P>
<H1><A NAME="SECTION00580000000000000000">
2.8 Creating Files</A>
</H1>
<P>
There are many ways of creating a file. Type <TT>
<FONT COLOR="#0000ff">cat > Mary_Jones.letter</FONT></TT>
and then type out a few lines of text. You will use this file in later examples.
The <TT>
<FONT COLOR="#0000ff">cat</FONT></TT> command is used here to write from the keyboard into a file
<TT>
<FONT COLOR="#0000ff">Mary_Jones.letter</FONT></TT>. At the end of the last line, press <IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-enter.png" ALT="Enter"> one more
time and then press <IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-ctrl.png" ALT="Ctrl">-<IMG ALIGN=ABSMIDDLE BORDER=0 SRC="key-D.png" ALT="D">. Now, if you type <TT>
<FONT COLOR="#0000ff">ls</FONT></TT> again, you will see the file <TT>
<FONT COLOR="#0000ff">Mary_Jones.letter</FONT></TT>
listed with any other files. Type <TT>
<FONT COLOR="#0000ff">cat Mary_Jones.letter</FONT></TT> <I>without</I>
the <TT>
<FONT COLOR="#0000ff">></FONT></TT>. You will see that the command <TT>
<FONT COLOR="#0000ff">cat</FONT></TT> writes the contents
of a file to the screen, allowing you to view your letter. It should match exactly
what you typed in.
<P>
<H1><A NAME="SECTION00590000000000000000">
2.9 Allowable Characters for File Names</A>
</H1>
<P>
Although U<SMALL>NIX</SMALL> file names
can contain almost any character, standards
dictate that only the following characters are preferred in file names:
<P>
<DIV ALIGN="CENTER"><TABLE CELLPADDING=1 WIDTH=360>
<TR><TD ALIGN="LEFT"><TT>
A</TT></TD>
<TD ALIGN="LEFT"><TT>B</TT></TD>
<TD ALIGN="LEFT"><TT>C</TT></TD>
<TD ALIGN="LEFT"><TT>D</TT></TD>
<TD ALIGN="LEFT"><TT>E</TT></TD>
<TD ALIGN="LEFT"><TT>F</TT></TD>
<TD ALIGN="LEFT"><TT>G</TT></TD>
<TD ALIGN="LEFT"><TT>H</TT></TD>
<TD ALIGN="LEFT"><TT>I</TT></TD>
<TD ALIGN="LEFT"><TT>J</TT></TD>
<TD ALIGN="LEFT"><TT>K</TT></TD>
<TD ALIGN="LEFT"><TT>L</TT></TD>
<TD ALIGN="LEFT"><TT>M</TT></TD>
<TD ALIGN="LEFT"><TT>N</TT></TD>
<TD ALIGN="LEFT"><TT>O</TT></TD>
<TD ALIGN="LEFT"><TT>P</TT></TD>
<TD ALIGN="LEFT"><TT>Q</TT></TD>
<TD ALIGN="LEFT"><TT>R</TT></TD>
<TD ALIGN="LEFT"><TT>S</TT></TD>
<TD ALIGN="LEFT"><TT>T</TT></TD>
<TD ALIGN="LEFT"><TT>U</TT></TD>
<TD ALIGN="LEFT"><TT>V</TT></TD>
<TD ALIGN="LEFT"><TT>W</TT></TD>
<TD ALIGN="LEFT"><TT>X</TT></TD>
<TD ALIGN="LEFT"><TT>Y</TT></TD>
<TD ALIGN="LEFT"><TT>Z</TT></TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>
a</TT></TD>
<TD ALIGN="LEFT"><TT>b</TT></TD>
<TD ALIGN="LEFT"><TT>c</TT></TD>
<TD ALIGN="LEFT"><TT>d</TT></TD>
<TD ALIGN="LEFT"><TT>e</TT></TD>
<TD ALIGN="LEFT"><TT>f</TT></TD>
<TD ALIGN="LEFT"><TT>g</TT></TD>
<TD ALIGN="LEFT"><TT>h</TT></TD>
<TD ALIGN="LEFT"><TT>i</TT></TD>
<TD ALIGN="LEFT"><TT>j</TT></TD>
<TD ALIGN="LEFT"><TT>k</TT></TD>
<TD ALIGN="LEFT"><TT>l</TT></TD>
<TD ALIGN="LEFT"><TT>m</TT></TD>
<TD ALIGN="LEFT"><TT>n</TT></TD>
<TD ALIGN="LEFT"><TT>o</TT></TD>
<TD ALIGN="LEFT"><TT>p</TT></TD>
<TD ALIGN="LEFT"><TT>q</TT></TD>
<TD ALIGN="LEFT"><TT>r</TT></TD>
<TD ALIGN="LEFT"><TT>s</TT></TD>
<TD ALIGN="LEFT"><TT>t</TT></TD>
<TD ALIGN="LEFT"><TT>u</TT></TD>
<TD ALIGN="LEFT"><TT>v</TT></TD>
<TD ALIGN="LEFT"><TT>w</TT></TD>
<TD ALIGN="LEFT"><TT>x</TT></TD>
<TD ALIGN="LEFT"><TT>y</TT></TD>
<TD ALIGN="LEFT"><TT>z</TT></TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>
0</TT></TD>
<TD ALIGN="LEFT"><TT>1</TT></TD>
<TD ALIGN="LEFT"><TT>2</TT></TD>
<TD ALIGN="LEFT"><TT>3</TT></TD>
<TD ALIGN="LEFT"><TT>4</TT></TD>
<TD ALIGN="LEFT"><TT>5</TT></TD>
<TD ALIGN="LEFT"><TT>6</TT></TD>
<TD ALIGN="LEFT"><TT>7</TT></TD>
<TD ALIGN="LEFT"><TT>8</TT></TD>
<TD ALIGN="LEFT"><TT>9</TT></TD>
<TD ALIGN="LEFT"><TT>.</TT></TD>
<TD ALIGN="LEFT"><TT>_</TT></TD>
<TD ALIGN="LEFT"><TT>-</TT></TD>
<TD ALIGN="LEFT"><TT>~</TT></TD>
<TD></TD>
<TD></TD>
<TD></TD>
<TD></TD>
<TD></TD>
<TD></TD>
<TD></TD>
<TD></TD>
<TD></TD>
<TD></TD>
<TD></TD>
<TD></TD>
</TR>
</TABLE>
</DIV>
<P>
Hence, never use other punctuation characters, brackets, or
control characters to name files. Also, never use the space or
tab character in a file name, and never begin a file name with a
<TT>
<FONT COLOR="#0000ff">-</FONT></TT> character.
<P>
<H1><A NAME="SECTION005100000000000000000">
2.10 Directories</A>
</H1>
<P>
I mentioned that a system may typically contain 10,000 files. Since it would
be cumbersome if you were to see all 10,000 of them whenever you typed <TT>
<FONT COLOR="#0000ff">ls</FONT></TT>,
files are placed in different ``cabinets'' so that files of the same type
are placed together and can be easily isolated from other files. For instance,
your letter above might go in a separate ``cabinet'' with other letters. A ``cabinet''
in computer terms is actually called a directory. This is the third commonality
between all computer systems: all files go in one or another directory. To get
an idea of how directories work, type the command <TT>
<FONT COLOR="#0000ff">mkdir letters</FONT></TT>, where <TT>
<FONT COLOR="#0000ff">mkdir</FONT></TT>
stands for <I>make directory</I>. Now type <TT>
<FONT COLOR="#0000ff">ls</FONT></TT>. This will show the file
<TT>
<FONT COLOR="#0000ff">Mary_Jones.letter</FONT></TT> as well as a new file, <TT>
<FONT COLOR="#0000ff">letters</FONT></TT>. The file
<TT>
<FONT COLOR="#0000ff">letters</FONT></TT> is not really a file at all, but the name of a directory in
which a number of other files can be placed. To go <I>into</I> the directory
<TT>
<FONT COLOR="#0000ff">letters</FONT></TT>, you can type <TT>
<FONT COLOR="#0000ff">cd letters</FONT></TT> where <TT>
<FONT COLOR="#0000ff">cd</FONT></TT> stands for
<I>change directory</I>. Since the directory is newly created, you would not
expect it to contain any files, and typing <TT>
<FONT COLOR="#0000ff">ls</FONT></TT> will verify such by not
listing anything. You can now create a file by using the <TT>
<FONT COLOR="#0000ff">cat</FONT></TT> command as
you did before (try this). To go back to the original directory that you were
in, you can use the command <TT>
<FONT COLOR="#0000ff">cd ..</FONT></TT> where the <TT>
<FONT COLOR="#0000ff">..</FONT></TT> has the special
meaning of taking you out of the current directory. Type <TT>
<FONT COLOR="#0000ff">ls</FONT></TT> again to
verify that you have actually gone <I>up</I> a directory.
<P>
It is, however, bothersome that we cannot tell the difference between files and
directories. The way to differentiate is with the <TT>
<FONT COLOR="#0000ff">ls -l</FONT></TT> command. <TT>
<FONT COLOR="#0000ff">-l</FONT></TT>
stands for <I>long</I> format. If you enter this command, you will see a lot
of details about the files that may not yet be comprehensible to you. The three
things you can watch for are the file name on the far right, the file size (i.e.,
the number of bytes that the file contains) in the fifth column from the left,
and the file type on the far left. The file type is a string of letters of which
you will only be interested in one: the character on the far left is either
a <TT>
<FONT COLOR="#0000ff">-</FONT></TT> or a <TT>
<FONT COLOR="#0000ff">d</FONT></TT>. A <TT>
<FONT COLOR="#0000ff">-</FONT></TT> signifies a regular file, and a <TT>
<FONT COLOR="#0000ff">d</FONT></TT>
signifies a directory. The command <TT>
<FONT COLOR="#0000ff">ls -l Mary_Jones.letter</FONT></TT> will list
only the single file <TT>
<FONT COLOR="#0000ff">Mary_Jones.letter</FONT></TT> and is useful for finding out
the size of a single file.
<P>
In fact, there is no limitation on how many directories you can create within
each other. In what follows, you will glimpse the layout of all the
directories on the computer.
<P>
Type the command <TT>
<FONT COLOR="#0000ff">cd /</FONT></TT>, where the <TT>
<FONT COLOR="#0000ff">/</FONT></TT> has the special meaning
to go to the topmost directory on the computer called the <I>root</I> directory.
Now type <TT>
<FONT COLOR="#0000ff">ls -l</FONT></TT>. The listing may be quite long and may go off the top
of the screen; in that case, try <TT>
<FONT COLOR="#0000ff">ls -l | less</FONT></TT> (then use PgUp and PgDn,
and press q when done).
You will see that most, if not all, are directories. You can
now practice moving around the system with the <TT>
<FONT COLOR="#0000ff">cd</FONT></TT> command, not forgetting
that <TT>
<FONT COLOR="#0000ff">cd ..</FONT></TT> takes you up and <TT>
<FONT COLOR="#0000ff">cd /</FONT></TT> takes you to the root directory.
<P>
<I>At any time you can type <TT>
<FONT COLOR="#0000ff">pwd</FONT></TT> (<I><TT>
<FONT COLOR="#0000ff">p</FONT></TT>resent
<TT>
<FONT COLOR="#0000ff">w</FONT></TT>orking <TT>
<FONT COLOR="#0000ff">d</FONT></TT>irectory</I>) to show the directory you are
currently in.</I>
<P>
When you have finished, log out of the computer by using the <TT>
<FONT COLOR="#0000ff">logout</FONT></TT> command.
<P>
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html1743"
HREF="node6.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
<A NAME="tex2html1739"
HREF="rute.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
<A NAME="tex2html1733"
HREF="node4.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
<A NAME="tex2html1741"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1744"
HREF="node6.html">3. PC Hardware</A>
<B> Up:</B> <A NAME="tex2html1740"
HREF="rute.html">rute</A>
<B> Previous:</B> <A NAME="tex2html1734"
HREF="node4.html">1. Introduction</A>
  <B> <A NAME="tex2html1742"
HREF="node1.html">Contents</A></B>
<!--End of Navigation Panel-->
</BODY>
</HTML>
|