User Tools

Site Tools


opus:fall2011:vcordes1:part3

Part 3

Entries

November 2011

  • What action or concept of significance, as related to the course, did you experience on this date?
  • I got to experience a semi real world data issue
  • Why was this significant?
  • It is an example of something I may encounter as part of the work force
  • What concepts are you dealing with that may not make perfect sense?
  • Why people would use so many different formats to save data.
  • What challenges are you facing with respect to the course?
  • It was time consuming to extract only the data we wanted but other than that it was a fun project

November 2011

  • What action or concept of significance, as related to the course, did you experience on this date?
  • I got to experience a way to make things easier with respect to extracting data.
  • Why was this significant?
  • As opposed to making one long line of commands and regular expressions it can be more efficient and practical to just output to files and work from there.
  • What concepts are you dealing with that may not make perfect sense?
  • I have a tendency to want to do things the hard way, I have no idea why
  • What challenges are you facing with respect to the course?
  • Really complex regular expressions still take time to produce although I feel that is an issue that has to do with experience.

November 2011

  • What action or concept of significance, as related to the course, did you experience on this date?
  • xhost - and xhost +
  • Why was this significant?
  • It is useful in preventing people from messing with your terminal
  • What concepts are you dealing with that may not make perfect sense?
  • I didn't at first know how it worked or why it worked
  • What challenges are you facing with respect to the course?
  • None

November 2011

  • What action or concept of significance, as related to the course, did you experience on this date?
  • Man pages
  • Why was this significant?
  • I can finally effectively read man pages to a point where they are actually useful to me
  • What concepts are you dealing with that may not make perfect sense?
  • Why man pages are written so cryptic as to really take a couple of months of reading them to really use them effectively.
  • What challenges are you facing with respect to the course?
  • Not as may as man pages contain a lot of information and can be used as a starting point to solve most problems

unix Topics

Home directory

The home directory is YOUR directory. It is where all of a users personal files should be kept the only one with the ability to alter anything in a home directory is the user. (permissions, removing, etc) Permissions can be set for other users to enter the directory at all, and or view anything in the directory. Cd will return the user to the home directory for that user.

lab46:~$ "This is what the prompt looks like in the home directory"

Ownership

Ownership of a file is determined by who created the file. If permissions permit it files can be copied and manipulated from the copy should the owner not want the original file altered.

lab46:~$ touch file
lab46:~$ nano file
lab46:~$ vi file

Pattern Matching

Pattern matching is a very useful skill to posses when working with regular expressions. Being able to find a pattern, and tell the system to alter replace or remove parts of or around that pattern makes data manipulation much more efficient.

lab46:~$ cat spring2012-20111103.html | grep "dddefault"
<TD CLASS="dddefault">Class</TD>
<TD CLASS="dddefault">9:40 am - 11:30 am</TD>
<TD CLASS="dddefault">MW</TD>
<TD CLASS="dddefault">Classroom C203</TD>
<TD CLASS="dddefault">Jan 23, 2012 - May 13, 2012</TD>
<TD CLASS="dddefault">Lecture</TD>
<TD CLASS="dddefault">Barbara L. Squires (<ABBR title= "Primary">P</ABBR>)<A HREF="mailto:squires@corning-cc.edu"    target="Barbara L. Squires" ><IMG SRC="/wtlgifs/web_email.gif" ALIGN="middle" ALT="E-mail" TITLE="E-mail"  NAME="web_email" HSPACE=0 VSPACE=0 BORDER=0 HEIGHT=28 WIDTH=28></A></TD>

With this particular example matching the “dddefault” pulls out only the lines with that pattern. The data can be further manipulated to display only the useful information within the file such as the time and location.

Tab Completion

The tab key can be used to complete a stuff. (for lack of a better way to explain it) This is very useful in saving time and effort when typing as all you need for a completion is enough of a matching at the beginning of said stuff.

lab46:~$ cat fi(tab)
"This is an example"

Program vs. Process

A program would be code that has to be compiled in order to perform its functions. A process would be run directly from the shell with no compiling required. An example would be a C tetris program vs. cating a file.

Moving/Renaming

Files can be moved and renamed as long as permissions permit whenever wanted or necessary. For example I went through my home directory and created directories for similar files then proceeded to move those files into the directories. Moving and renaming can be done with “mv.” To move a file use mv file destination. To rename a file use mv file newfile.

lab46:~$ mv file Files
lab46:~$ mv file newfile

Netiquette, Security

Netiquette is as defined by wikkipedia a set of social conventions that facilitate interaction over networks. From a unix standpoint it would be the social interactions on the network. Proper netiquette would would be respecting users privacy if you happen to have root access and just being generally polite while interacting with other users. Security in Unix is done easily and effectively. With every file needing to have permissions set to people beyond the owner and root as long as no one has the password for root or the UID files and information are secure.

Creating

Have you ever wanted to know what it feels like to be able to bring anything your heart desires into existence. With a Linux system you can with little more than a thought. Files of unthinkable power can be created with the touch command, or any text editor.

lab46:~$ touch universe
lab46:~$ vi mountain
lab46:~$ nano ocean
lab46:~$ ./world
Hello, World!

Text Processing

Text processing is essentially typing. A text processor such as vi, or nano can save the typed text for later use. The text in the then file can be changed at any time in any way provided permissions.

lab46:~$ vi file
Hi
Hello
Good day
Hola

Directory

The simplest way I can think to explain directories is to compare them to a windows system. They are kind of like (kind of like) folders in Windows. Directories are used to organize files and I believe they are called directories because of how Linux systems work, with the file system needing paths to locate and utilize files, directories as a term makes sense. You can change directories using the cd command. By itself cd will take you to your home directory, followed by a directory name (cd src) it will take you into that directory, and with a path it will take you wherever you want to go. (cd /home/../usr/games)

lab46:~$ cd src
lab46:~/src$ cd 
lab46:~$ cd /home/../usr/games
lab46:/usr/games$ cd
lab46:~$ 

Copying

Files within a Linux system can be copied. This is necessary for a million different reasons some examples may be the need to have a back up of the file, or needing to send the file to someone else while still having a “copy” of it for yourself. Whatever the reason copying files can be done with cp. The convenient method to copy text from a file or command line to a file is to highlight the desired text and press the middle mouse button (scroll wheel) if your mouse has one if not a simultaneous right and left click should work at the location you want the text. When copying a file the file with by default copy to the current working directory and it will only copy should you chose a new name for the file. Files can be copied from anywhere to anywhere with permissions and a path.

lab46:~$ cp file newfile
lab46:~$ ls
file newfile Files
lab46:~$ cp file Files
lab46:~$ cd Files
lab46:~$ ls
file

Compressing/Decompressing

Files in a Linux system can be compressed and decompressed. The compressing a file can be done with gzip, and decompressing a file can be done with gunzip. Compressing is usually only necessary for really large files and or saving space.

lab46:~$ gzip file
lab46:~$ ls
file.gz
lab46:~$ gunzip file
lab46:~$ ls
file

unix Objective

Objective

Understanding and use of pattern matching. To more efficiently collect, sort, or manipulate data patterns are incredibly useful as you need something to match when using regular expressions.

Method

I will find a file with a bunch of unnecessary data and extract the data that I want.

Measurement

Using the text document I found it was very easy to extract only the data I wanted after finding a pattern to use.

Analysis

  • How did you do?
  • Fairly well
  • Room for improvement?
  • There is always room for improvement, there were a ton of different patterns within the file and perhaps a different pattern would have been more efficient.
  • Could the measurement process be enhanced to be more effective?
  • I probably could have used a harder file to make it more challenging
  • Do you think this enhancement would be efficient to employ?
  • Yes and it already has been and is
  • Could the course objective be altered to be more applicable? How would you alter it?
  • It is an important concept to understand and it can be used outside of the course, the only thing I would change about it is the amount of attention it is given. By that I mean increase it.

Experiments

Experiment 1

Question

Can I use cron to determine the number of users on the system Tuesday and Thursday at 3:00pm with a small shell script.

Resources

UnixMages.com “A run in with Cron”

Hypothesis

I think it will work.

Based on my knowledge of shell scripting provided I do it correctly and my knowledge of cron, provided I do it correctly.

Experiment

I am going to sit in class on Tuesday and Thursday and wait to see if a new file pops up with the number of users contained in it.

Data

I waited in class and my cron1 file updated with the number of users on the system at 3:00 pm.

Analysis

Based on the data collected:

  • was your hypothesis correct?
  • yes
  • was your hypothesis not applicable?
  • It was applicable
  • is there more going on than you originally thought? (shortcomings in hypothesis)
  • Negative there was success
  • what shortcomings might there be in your experiment?
  • none
  • what shortcomings might there be in your data?
  • none

Conclusions

Cron works exactly as I read it to work. Very successful very pleased.

Experiment 2

Question

This was something that I just happened upon and decided to include it as an experiment just to put it in somewhere. So as a question to experimental purposes I am going to propose, can wc -l be used to produce a truly accurate count of users on the system.

Resources

Basic knowledge of commands

Hypothesis

Yes it will work

I know that wc -l produces a count of lines, so it is just a matter of finding the lines that should not be counted, and not counting them

Experiment

I am going to find out manually how many users are on the system, at the moment it is just me so that part is easy. I will then look at the lines that should not be included…(using who as opposed to w here) from there I will use a method of not including them and then count the lines with wc -l.

Data

who | grep -v “NAME” | wc -l 1

Analysis

Based on the data collected:

  • was your hypothesis correct?
  • yes
  • was your hypothesis not applicable?
  • it was applicable
  • is there more going on than you originally thought? (shortcomings in hypothesis)
  • Negative everything was as expected
  • what shortcomings might there be in your experiment?
  • It may have been too easy
  • what shortcomings might there be in your data
  • None small experiment means that everything is fairly straight forward

Conclusions

I can conclude that any count of users I have done throughout the semester has been off by at least 1 possibly more depending on multiple logins and what not due to how wc -l works. I do know now that if I want something that is 100% accurate I have to do a little more work.

Retest

If you're doing an experiment instead of a retest, delete this section.

If you've opted to test the experiment of someone else, delete the experiment section and steps above; perform the following steps:

State Experiment

I will be retesting Derik Girard's experiment http://lab46.corning-cc.edu/opus/fall2011/dgirard3/start#experiment_1, his question was can I create a file with a space in the name.

Resources

Evaluate their resources and commentary. Answer the following questions:

  • Do you feel the given resources are adequate in providing sufficient background information?
  • Yes
  • Are there additional resources you've found that you can add to the resources list?
  • No
  • Does the original experimenter appear to have obtained a necessary fundamental understanding of the concepts leading up to their stated experiment?
  • Yes
  • If you find a deviation in opinion, state why you think this might exist.
  • I do not

Hypothesis

Something to the extent of I believe it can be done with quotes

  • Do you feel their hypothesis is adequate in capturing the essence of what they're trying to discover?
  • Yes
  • What improvements could you make to their hypothesis, if any?
  • None

Experiment

Follow the steps given to recreate the original experiment. Answer the following questions:

  • Are the instructions correct in successfully achieving the results?
  • Yes
  • Is there room for improvement in the experiment instructions/description? What suggestions would you make?
  • I would say that there is a bunch of unnecessary screen shots but other than that it is good
  • Would you make any alterations to the structure of the experiment to yield better results? What, and why?
  • No and quotes are good

Data

I used touch “experi ment” and created one file named experi ment

Analysis

Answer the following:

  • Does the data seem in-line with the published data from the original author?
  • yes
  • Can you explain any deviations?
  • no deviations
  • How about any sources of error?
  • None
  • Is the stated hypothesis adequate?
  • Yes

Conclusions

Answer the following:

  • What conclusions can you make based on performing the experiment?
  • I have a new option for naming files
  • Do you feel the experiment was adequate in obtaining a further understanding of a concept?
  • Maybe
  • Does the original author appear to have gotten some value out of performing the experiment?
  • Yes
  • Any suggestions or observations that could improve this particular process (in general, or specifically you, or specifically for the original author).
  • No
opus/fall2011/vcordes1/part3.txt · Last modified: 2011/11/29 20:29 by vcordes1