Table of Contents


Corning Community College


UNIX/Linux Fundamentals



End of Course Experience

~~TOC~~

Rules

Presented within will be various questions evaluating your knowledge and experience gained this semester. In places where you are able, the more you write and explain topics the better the chance you will have of receiving full credit (and alternatively, the more credit you will receive should something be incorrect).

The questions on this experience are open resource with the exception of other individuals. In that respect, it is CLOSED PERSON. This means you are not to communicate with other people (either in the class or otherwise), in real life or electronically. Use your own knowledge, use your skills, and use your ability to access the allowed resources to aid you in coming up with your well thought out answers to each question.

You are allowed, and expected, to ask me questions, so that a problem can be better clarified.

There are three parts to this experience:

You are to do all questions. Submission is to be in an organized and easy to read format in a plain text file, such as in an e-mail with attachments on Lab46, sent to wedge@lab46.corning-cc.edu and yourself.

You have until 11:59:59pm (that's 23:59:59 in 24-hour time) Friday, December 17th, 2010 to complete and submit this to me.

If desired, our scheduled finals week meeting time is: Monday, December 13th, 2010 from 2:30pm-5:30pm in B003 (our regular room).

Good luck!

Part I: Questions

0x0: Permissions

For the following permissions:

a. drwxr-x--x
b. crw-r-----
c. -r---w--wx
d. p--xrw-rwx

0x1: RegEx

Write me regular expressions that, when used against a file like /usr/share/dict/words, will return only the following (give me the entire command-line or regex, AND number of results):

a. All the 6 letter words that begin with "pre" XOR end with "ing".
b. All the words that begin with "pre" or "post" and do NOT end with "ing".
c. All the words whose even placed characters are a vowel (only lowercase, 'y' excluded).
d. All the words whose even placed characters are a vowel (only lowercase, 'y' included).
e. All the words that do not contain any of the letters 'a' or 'A'.
f. Words that do not contain any of your initials (first, middle, last, upper, and lower).

0x2: Mystery

In the /var/public/unix/eoce directory is an executable named mystery. Run this program and tell me the following:

a. Does the program output to STDOUT or STDERR?
b. How can you prove this?

Be sure to justify your answer and provide proof that backs up your claims.

0x3: Files

The /etc/shadow file contains account password information for certain users on the system.

a. How would you show me the encrypted password for one of the accounts?
b. If you try it, are you able to accomplish the task? Why or why not?
c. Why do you suppose that is?
d. What would be the benefit of doing something like this?

Be sure to answer ALL four parts.

0x4: Paths

Tell me whether each of the following is a relative or absolute path:

a. /usr/local/bin/usage
b. bin/bash
c. /usr/share/../../tmp
d. ./var/lib/dpkg

0x5: Files

Tell me what type of file (regular, directory, special) for each of the following, and provide your reasoning for such:

a. /etc/group
b. /usr/lib/libsvn_diff-1.so.1.0.0
c. /dev/pts/*
d. /proc/cpuinfo

0x6: Matching

What tool(s) would I use to access/process the following in the most common sense fashion? Identify what the file is, and show me an example command-line

a. stuff.tar.gz
b. trees.bz2
c. text_file_with_100_lines_you_want_to_read
d. roms.zip

0x7: Wildcards

Show me how you'd list the following:

a. All the files in the base of /proc that contain 4 characters and begin with a '1' or a '2'.
b. All the files in the base of /dev that end with '6' or 'v' or 'V'.
c. All the files in the base of /etc that begin and end with an 'r','s','t','l','n', or 'e'.
d. All the files in /bin that are symlinks AND 6 characters in length.

Part II: Scripting

0x8: Tetris Score Listing

The text-based tetris-bsd on Lab46 enjoys considerable usage. It maintains a scoreboard of all who have played and how high they've placed (and on what level).

I'd like for you to take the tetris scores and write a shell script that will turn it from its multiple page double column output to a unified single-column list.

From that list it creates, identify the user who has the most entries in the high score table, as well as the users who have placed on level 4.

0x9: A 'last'ing impression

Utilizing the last utility, write a script that will output the following information:

0xA: emordnilaP as a Palindrome

Write two scripts, each one accepting as input two strings.

Each script must validate whether or not the two input strings are palindromes (or not), and output a message appropriately.

Each script must perform its palindrome processing in an entirely different way from the other.

The intent here is to come up with fundamentally different ways of solving a problem.

0xB: Grade Calculation

Throughout the semester, the Grade Not-Z has been regularly processing your journal entries, attendance, and other assignments into various text files residing in a ~/data/ directory you made earlier in the semester.

Specifically, there are 3 files of interest:

Looking back to the syllabus, you'll see that each of these areas constitutes one of the main sections of the grading policy. The journal is worth 36%, assignment are worth 36%, and attendance/participation is 28%. 36+36+28=100, so the data contained within these files will be used to calculate your grade for the course.

What I'd like you to do is write a script which takes the data in these files, and appropriately calculates and outputs:

Your script must do the appropriate calculations (is it out of 36 or 28, calculating percentage per each section correctly, etc.) and output the requested information in an easy-to-read fashion.

Part III: Things that aren't in the first two parts

0xC: The UNIX Philosophy

What is the UNIX philosophy?

And how does that philosophy play a part in various places on a UNIX system, and even in various ideals behind coming up with solutions and computing in general?

0xD: * vs. *.*

The first UNIX filesystems allowed for filenames to be up to 14 characters in length. As time went by, this limit increased to 255 characters, and even larger (around 10,000 characters). In UNIX, there is no concept of an extension (ie in MS-DOS you have 8 characters followed by a 3 letter extention– known as 8.3 notation). However, the concept of the file extension is still in common use but used to help the user distinguish files (just as with the –color=auto option to ls(1), files are colorized). The underlying operating system doesn't care what extension or color the file is, but it can be useful to the user.

In DOS, a common wildcard to specify all files is: *.*

In UNIX, why is * better than: *.*

Explain your answer.

0xE: Script Review

We have spent considerable time and efforts on shell scripting this semester. Especially with our significant example exploring the course offerings, there was an emphasis on the validity of likely many methods for arriving at the solution.

In class explored one example with considerable detail, now I will present you with a few solutions (including what we had done in class) to ask you to pick apart and explain various aspects of the solutions.

Take a look at the scripts and respond to the following:

0xF: Your Perspective

After an exciting and intellectually challenging run, we're arriving at the end of this semester's journey. The course as we all experienced it, unfolds in a manner pertaining in part to how you respond to concepts and topics (do we need more time, can I crank it up a couple notches, etc.) so each semester and each class is entirely different from any other- because of each of you, and all of us, working together and learning together.

So, searching deep down within your soul- balancing reason with emotion, and considering attendance and timeliness; answer me the following: