Set-up for the Very First Session Only


We will be working in the Linux KDE environment in this class.

The very first time you sit down at a CS student lab computer you will need to set up your default environment, log in, and change your password.

To set up your default environment:
1. Move the mouse across the screen. A welcome screen requesting your Username should appear. Ignore it for a moment.

2. First, across the bottom of the screen you should see a banner with the words:

>Language >Session >Reboot >Shut down


Pick (left-click on) the word >Session


  1. A new window will pop up. In this window, pick KDE, then OK


  1. Now type your username followed by the Enter key. In general, your username is based on your last name, but all in lower case. Your username is:



  1. A new window asking for your password will pop up. Your initial password is your social security number. Type in your social security number followed by the Enter key. No dashes or spaces, please, and do not use the number pad. The password will not "echo” anything on the disply. Don't worry about it!

  1. The system should begin the process to log you into KDE (it will take a bit of time to do this).



Logging Out (for the end of a session)


IMPORTANT: Please be sure you always log out when you leave a system.


When you are ready to log out, pick (left-click) the red hat icon in the lower left-hand corner of the screen, pick the Logout option from the list that pops up (usually it is the last item listed), and pick Logout (or otherwise confirm the logout request) from the End session window that appears.



Getting Started in Linux

You are now in the Fedora Linux Desktop Environment (KDE). Notice that the screen looks different from a PC or Mac running Windows. There are several icons across the bottom of the screen. For this seminar we will probably only use the Main Menu (Red Hat) and the Mozilla web browser (globe with a mouse).

The first thing to do is to change your password to something more secure. First you will need to get a special terminal window that lets you talk more directly to Linux, then you will type a command to let you change your password.



Opening a New Terminal Window

Terminal windows let you talk directly to the Linux operating system. You will need terminal windows frequently when you use the Linux environment. To open a new terminal window:

Changing Your Password

Now you need to change your password. In the terminal window you just opened, type exactly this command:

npasswd

Followed by the Enter key. Follow the directions you see. You may have to type yes and possibly enter your present password (your social security number) once or twice (again, there will be no “echo"), but presently you will see a prompt that says:

New password (? for help):

A good password includes both letters and digits and/or special characters (like a comma). It is one you can remember easily, but not one other people can easily guess. Pick a new password and enter it twice, each time followed by the Enter key.

Using the Mozilla Browser

I believe all of you are very experienced with web browsers. We will begin this seminar using the Mozilla web browser. Start it up by picking the globe with a mouse (second icon from the left at the bottom of your screen). It should look very similar to other browsers you have used. Check out the announcment for this seminar by typing

http://www.cs.colostate.edu/~regelson/hsclass.html

and Enter in the web address window (the white banner high up and near the center); or go to www.google.com or some other favorite web location. Set the browser up so you will be able to print a page you like by picking File, then Print. A Print window should pop up.

Pick the Properties box. A Printer Properties window should pop up. In the Print Command: entry area type:

lpr -Psax

(The "lpr" stands for “lineprinter” so the first character is a lower case letter L.)

While you are here, pick the GrayScale option, since all of our printers on this floor are black and white.

Now pick OK and the Printer Properties window should disappear. From now on you will be able to print out a page, if you wish, to the printer named "sax"(short for saxophone; it is straight outside the lab door, next to our conference room). Go ahead and try this if you wish by selecting Print; or pick Cancel if you have nothing you wish to print at the moment.

Now go back to the seminar announcement page. Right-click anywhere on the main screen and pick View Page Source from the menu that pops up. A new window will pop up showing you the html language that is used to build this page. Look at it. See if you can find similarities between the html and the web pages it displays.

Go ahead and explore Mozilla further for a bit if you wish. When you are ready, move on to set up CS Department email, and then to learn more about the Linux environment.

Setting Up Mozilla email

  1. Bring up the Mozilla browser if you have not done so already

  2. Pick the Window command (it is at the top of the screen).

  3. Pick Mail & Newsgroups

  4. A mail window and a setup wizard should start.

  1. Fill in Your Name. In the email window type

  1. Pick Next.

  2. The next window should be called "Server Information". Pick IMAP

  1. The next window is labelled "UserName" Fill in your CS department login name (if necessary) and pick Next

  2. No changes are needed in the "Account Name" page. Just pick Next

  3. The last window is labelled "Congratulations!" Pick Finish

  4. Enter your password if prompted to do so.

  5. Pick Edit from the command line at the top of the screen.

  6. Pick Mail & Newsgroups Account Settings

  7. Pick "Sever Settings" from he list at the left.

  8. Pick Advanced

  9. Type Mail in the "IMAP Server Directory" space.

  10. Pick OK twice.

  11. You are now set up to send and receive email!


(Note: CS students may choose to forward their email to a different address by creating a text file named exactly “.forward” in their home directory and containing exactly the email address to which they want the mail re-dircted. Don't do this unless you understand what it means or you have help.)



About The Linux Environment

Linux is fussy!

Linux is a very fussy environment. Case matters on all commands and filenames. Always assume lower case. To “execute” a command, type the command followed by the Enter key.

In most instructions, a lower-case L (l) looks exactly like a numeral one (1). All commands are letters; in all seminar instructions, assume that this character is a lower-case “L” unless the instructions explicitly say otherwise.

Linux commands are generally in the form of: verb adjective[s] object[s]

The verb is the command and is required. The adjective[s] (modifiers) and object[s] are optional. Let's take a look at some of them to see the patterns.

Computer programming wisdom says that you make the computer do as much of the work for you as possible. Ways to make the computer do more of the work will be introduced as we move along. I encourage you to use them!

First Linux Commands

Pick your terminal window. You can find it by minimizing your browser, or by picking “Terminal” from the boxes at the bottom of your screen. If you need to do so, start a new terminal window (RedHat icon-System Tools-New Terminal).

Tell the computer to tell you who it thinks you are by typing the command:

whoami

followed by the Enter key. The computer should print back your login name. Now that you know you and the computer agree about who you are, take a look at “where” the computer thinks you are.

Linux by default starts you in your “home directory”. A directory in Linux is exactly like a folder in a Windows environment. It can hold other directories or files, such as simple text, documents, and so on. Linux maintains an extensive tree of lots of folders within folders, and, in general, folders for users are kept way down in the tree. To see where you presently are in the Linux structure, enter the command that will display the present working directory:

pwd {followed it with the Enter key, but I am going to stop saying this. :-)}

You will see a list of directory names separated by slashes; the last item listed should be the same as your login name. Linux knows about you as a user (someone who may log in) and has reserved a directory, or file folder, in your name in which you may store your work.

To see what is in this directory already you need to list it by typing the command

ls

(remember -- all letters). You will probably see a file named README. You don't really need to know what is in this file, but it gives you a chance to learn “more” -- a very useful command that will print out the contents of a text file. To see what is in this file, enter the command

more README

The contents of this file will be displayed in your terminal window, screenful by screenful. Don't bother reading what it says unless you are really interested. Display the next screenful by striking the spacebar or quit the command by typing a q.

Here is a chance to show you your first “shortcut.” Start to enter the command again. Type “more R” and then type the Tab key. Linux will try to complete the command for you instead of making you type the “EADME”. You still need to type the Enter, though.

Creating New Files

You are accustomed to using a document processor, such as Microsoft Word, to create documents. Linux has document processors, also. But, since we are going to mostly be writing computer programs in our labs, instead we will use a program called a text editor. A text editor is similar to a document processor, but it creates files that are very simple text, with no special formatting or fonts. The text editor we will use for this class is a program called emacs. You can start emacs from a terminal window by typing

emacs myfile &

This command means “run the program named emacs to work in a file named 'myfile' but let me continue to use this terminal window for other work.” (The “&” is optional; it's the part that let's you continue to use the terminal window for other work.) After you enter this command you will see some text in your terminal window showing the job was done, and a new window will pop up. Your cursor should be ready to go in the new window. Type something -- maybe a short poem or a line of text -- in the new window. When you are happy with what you typed, pick File from the top of the emacs window and pick Save (current buffer) from the pulldown menu list that appears.

Copying Files

First make sure your new file is really there. Pick your terminal window again, and enter the list command:

ls

You should now see a file named myfile in the list of files in your home directory. See what is in this file by entering

more myfile

Does this look like what you typed?

Now let's make a copy of this file. Enter the command

cp myfile mynewfile

The computer will not show you it did anything, but will simply display the command prompt again. Do another list command to make sure the file is still there, and a more command to see what is in it. Now in your emacs window pick File, then Close (current buffer). Still in the File menu pick Open File. At the very bottom of this window a line will appear that says “Find file: /~” followed by a square-looking box. Type

mynewfile

followed by the Enter key. Now you can go change the file. Add another line, or change something about it. Then save the file again (File then Save (current buffer) or you may use the ctrl key and type ctrl-c ctrl-s). Do a more command on your new file in your terminal window, and see if the changes you just made are there (try more my and then a Tab key; Linux will finish the line for you!).

Removing Files

It is a good idea to clean up as you go along. The Linux rm command lets you remove files. Before you remove files, it is a good idea to use the pwd (present working directory) command and/or the ls (list) command to make sure you are really in the directory (folder) you think you are. Once you are sure you are where you want to be and that you no longer need these files enter the command

rm myfile mynewfile

This command just quietly returns a prompt. Do one more ls command so you can make sure the files are gone. Exit emacs (File then Exit Emacs) to finish cleaning up for now.

New Directories and Permissions

All of this was in preparation for building your first, made-by-hand, web page. To make things easier for programmers, the CSU CS department set up our machines to automatically look for web pages in a text file named index.html in a directory named public_html. To make the new directory enter the command

mkdir public_html

Linux is notoriously fussy. It requires that you explicitly set what it calls “permissions” so that everything works the way it is supposed to. We can explain this if you are interested; for now, just enter the command

chmod 711 public_html

Do a long listing

ll

(remember, both of those are lower-case L's). Now change directory so you are now looking inside this new directory:

cd public_html

(you could also type cd pu then a Tab to save some work). Do a pwd (present working directory) to see where you are, and list the contents of this directory; it should be completely empty.



Very Basic HTML Tutorial

Web pages are generally written in a very simple programming language called HTML (for HyperText Mark-up Language). HTML uses “tags” (commands embedded in angle brackets) to surround text. In general, each command has a start (a word or command enclosed in “angle brackets” <html >) and an end, which is a slash (/) in front of the same word or command. For instance, the very first entry in the file you will use to make your web page will be <html> and the very last entry will be </html>. Or, in this example, the word bold in this sentence will show up in bold type:

Here is an example of <b>bold</b> type.

Most but not all commands require end commands. For instance, to start a new line of text just use <br> (break) or <p> (new paragraph) (and HTML will almost never start a new line unless you tell it to do so!).

Your First Web Page

Create a terminal window if you need one. From the new terminal window, enter

emacs index.html &

In the new emacs window you are going to type exactly the following lines:

<html>

<head>

</head>

<body>

Hello! (or whatever you want for just this line, including your name)

</body>

</html>

Save this text into the index.html file by typing ctrl-c ctrl-s or by picking Save (current buffer) from the File menu.

Go back to your terminal (you may need to left-click in the window, or pick it from the box at the bottom of the screen).

Setting Permissions for Web Files

One last bit of fussiness is that you must specially set the permissions for any file you want to use from a web browser. The command to do this for the index.html file is

chmod 644 index.html

Now start up the Mozilla browser if it isn't already running. In the address block type http://www.cs.colostate.edu/~ and your loginname, then Enter.

(For instance, I type http://www.cs.colostate.edu/~regelson) Your very first web page should appear. Go back to emacs. Modify or add text lines near the Hello! (you may change it entirely). Do another text save and re-load the page to see your changes.