CIT050 Index > Assignment 1

Assignment 1–Introduction to Linux®

Read everything before doing anything.

Note: when these instructions have something to type in italics, substitute your own name or command for what is described. For example, if you see:

echo "your first name"

So, if your name were Thorstein Veblen, you’d type:

echo "Thorstein"

During this lab, you will login to a Linux workstation, play with a few commands, and generally start to get comfortable on a Linux®/UNIX® system. Since we haven’t talked about the commands yet, the purpose of this lab is experimental: try the commands, try to figure out what they do, and try looking them up in either the textbook or online. This assignment will be much easier if you read the textbook first!

Logging In

When you attended the orientation, you received a login name of the form linuxnnn, where nnn is a three-digit number. To log in to the Linux system from an internet-connected Windows machine, you will have to use a Secure Shell program. We recommend the putty program.

Here are instructions on how to log in.

Change Your Password

  1. Type passwd to change your password, then press ENTER. Do not type the word “password” at the command line–it won’t work!

  2. The server prompts you for your old password. Type it in; it will not show up on the screen, not even as little stars.

  3. The server prompts you for the new password. If it is too simple (letters only, or based on a dictionary word), it will tell you so and reject that password

    A good password has at least eight characters, made up of letters (upper and lowercase), digits, and punctuation. Try using the first letters of some famous saying or your favorite movie or song. For example, the song title “What is this thing called love?” followed by my oldest cousin’s age would become the password Wittcl?43. Never use your real name, nickname, login name, initials, birth date, or a common dictionary word as a password.

  4. After you finally find a good password, you will be prompted to re-enter that new password. Do so, and then press ENTER. If the passwords match (the new one and the re-entry), the server will tell you Password changed.

The Assignment

You will want to “rehearse” these steps. Do them a few times until you are sure you know what the correct commands are. Then, do them one more time as the final result to send to the instructor.

  1. Type script a1script at the prompt. That’s the digit one (1) after the letter “a”—this is assignment one, not assignment ell. The system will respond with

    Script started, file is a1script

    This means that the system will start “recording” all your input and output into a file named a1script.

  2. Type stty -a to see a list of all the attributes of your terminal.

  3. Try typing the letter X, then backspacing over it to see if it gets deleted.

  4. Type whoami to see your username.

  5. Type who to see a list of everyone on the system.

  6. Type finger to see your account and name.

  7. Type finger linuxnnn, (where nnn is your user number) to see more information about your account.

  8. Type date, to see today’s date and the current time.

  9. Type cal to see this month’s calendar.

  10. What files do you have? Type these three commands. Each one produces different output. The third command ends with the letter “ell,” not the digit one.

    ls
    ls -a
    ls -a -l

    What’s the difference? Note: If you have multiple one-letter options, you can combine them. We could have written the last of these commands as ls -al

  11. What’s in a file? Type these commands. The first one is a welcome message. Be sure to type ~linux199, not your user number. The second command produces a list of all the usernames on the system. It will scroll off the screen.

    cat ~linux199/welcome
    cat /etc/passwd
  12. See a file one page at a time; type less /etc/passwd

    Press the spacebar to move forward a page at a time, then q to get back to the command prompt.

  13. Create a file named test1 by typing this:

    echo "This is a one-line file" > test1
  14. Type these commands to see that the file exists, and what it contains. Note that the first command has the letter “ell” at the end, not the number one.

    ls -l
    cat test1
  15. Create another file by typing the following; where ^D means CTRL-D.

    cat > test2
    This is file two.
    It has several lines.
    Three lines, in fact.
    ^D
  16. See that the file exists, and what it contains. The last character in the command is the letter “ell,” not the digit one.

    ls -l
    cat test2
  17. Type sort test2

  18. End the script by typing exit

    The system will respond with Script done, file is a1script

  19. Typing exit again will log you off the Linux system.

When You Finish

Email the instructor to let him know you’ve finished the assignment and he can look at your a1script file. (If you look at it yourself, you’ll see lots of hard-to-read stuff. Don’t get stressed about it.) Your email’s subject line must read as follows, or your assignment will not be graded. (Replace nnn with the number portion of your user name.)

CIT050 Assignment 1 - linuxnnn

Acknowledgment

Thanks to Dr. Stan Isaacs of the College of San Mateo for much of the material in this assignment.