COSC 1436 Lab 1

Purpose: This lab is in two parts, focusing on validating your email account, and UNIX commands.

Due: Before class on January 31, 2013

Requirements:

Part 1. Send an email to me from your university account to larry.young@tamucc.edu. Include in the email a short biography of yourself that contains as a minimum your year in school, computer courses you have taken and what you liked or disliked about the courses, what courses are you taking this semester, what are your hobbies and interests, your computer background, and your expectation for the course. Include in this email anything else you would like your instructor to know about you. The subject line of this mail should be COSC 1436 Section X (2 or 3 as appropriate), Lab 1, Your Name.

Part 2. The second part of this lab involves performing some basic UNIX operations and preparing your CAMSLAB account for use during this semester. You will be writing all of your source code in the LINUX/UNIX environment this semester. Even though LINUX is somewhat similar to working with a Windows user interface, at some point in your career, you might run across a UNIX system that does not have such a friendly user interface. To prepare you for this eventuality, at the beginning of selected labs this semester, there will be a short exercises that will familiarize you with the basic commands used in UNIX.

UNIX Exercise:

In the lab, either find a computer that has been booted up into Windows or reboot a computer so that it will be running Windows and then log onto the system.If you have problems logging in, ask for help! Save this Lab 1 Answer Sheet and use it to answer the questions below. Save the document under the name "Lab1UnixAnswers" and make sure it is saved as a Word document (i.e., ".doc" extension).

  1. Open a terminal session by double-clicking on the Secure Shell icon. If you don't see the icon, click on "Start" and "All Programs" to find the SSH Secure Shell group. Log onto clst through Secure Shell. Once you are logged on, you should see something like this at the prompt:
    [yourName@clst yourName]$

where "yourName" is your user id.

  1. Type the word date at the prompt. Describe what is displayed.
  2. It's very common to need a listing of the files and directories that exist in your account. You can obtain this information by typing the ls command. To demonstrate how this works, perform the following:
    1. At the command line prompt, type the letters Ls (that's the lowercase letter 'L', not the number one) and press the <Enter> key.
    2. Describe what difference(s) you see between directories/folders and "regular" files.
    3. Now type this command: Ls -a and press the <Enter> key.
    4. Describe what difference(s) you see between the two commands. Describe what the -a option does?
  3. Each student has been allocated a quota of disk space for his/her use on clst.
    1. Find out what your quota is by typing quota at the prompt.
    2. Describe what is displayed and what your quota is.
  4. How can you tell if you've got enough room to save all your work?
    1. Find out how much space you've already used by typing du -s at the prompt. The du stands for "disk usage" and the -s option says you only want the total space used in your account. This value is given in kilobytes.
    2. Describe what is displayed and how much space you've already used.
  5. You need to make (and use!) individual directories for each of the labs. These directories should be created within a single directory called "1436Spring13" or similar name. There is a command in UNIX named mkdir that creates a directory specified on the command line. Make a 1436Spring13 directory by performing the following steps:
    1. Type the command mkdir 1436Spring13 and press the <Enter> key.
    2. Just for grins, type the same command again. Describe what is displayed.
  6. After you have created the 1436Spring13 directory, open the directory by typing this command: cd 1436Spring13 (be sure to include a space between CD and the directory name) and press the <Enter> key. Once you have opened the 1436Spring13 directory, describe, in detail, what the prompt looks like now.
  7. Once inside that directory, use the mkdir command to create directories for lab 1 through lab 14 (i.e., Lab01, Lab02, Lab03, Lab04, etc.). Do not put spaces in the directory names!
  8. Change directories back to the root by typing CD and pressing the <Enter> key.
  9. We next will look at permissions and how to change them. This will involve setting permissions for some directories. What are these permissions, you ask? There are three types of permissions: read, write, and execute. Here is a table that briefly describes a summary of these permissions as related to files and directories:

Ordinary File

Directory

Read

Can read from the file.

Can read from the directory.

Write

Can write to the file.

Can create, move, copy, or remove entries (i.e., files or other directories) from the directory.

Execute

Can execute the file.

Can search the directory.

 

How does the system know who has what permissions? If you type the command Ls -l (those are both lowercase letters, not the number one), you'll see a bunch of r's, w's, x's and hyphens in columns along the left side of the screen. There are actually three sets.The left-most set is for the user (that's you). The middle set is for the "group." For example, one of your groups would be "students who have accounts on clst." The right-most set is for everybody. That means the entire world.

The presence of an r, w, or x means permission is given to read, write, and execute respectively. If a hyphen (-) is present, that means permission is denied.

  1. Each permission is associated with a number (remember, everything is done with numbers in a computer!) as shown in this table:

Type of Permission

Numeric Value

Read

4

Write

2

Execute

1

No permission

0

  1. To combine the permissions, we add the values together for the individual permissions:

Read (r)

Write (w)

Execute (x)

Read (4)

Write (2)

Execute (1)

Total Value

-

-

-

0

0

0

0

-

-

x

0

0

1

1

-

w

-

0

2

0

2

-

w

x

0

2

1

3

r

-

-

4

0

0

4

r

-

x

4

0

1

5

r

w

-

4

2

0

6

r

w

x

4

2

1

7

 

Now that you know what permissions are, you need to make sure the permissions for your directories are set properly.

    1. This is done with the chmod command.
    2. Check your home directory permissions (that's the lone . in the Ls -l list) and make sure the permissions are set at 711 (i.e., drwx--x--x). If it's not, type "chmod 711 ." at the prompt. Be sure to include the single period after the 711!

EMAIL: Prepare an email to me and attach a filled out copy of the Lab 1 Answer Sheet

Grading Criteria: 40 points available for this lab.