User Tools

Site Tools


opus:spring2012:tedmist1:part3

Part 3

Entries

Entry 9: April 4, 2012

As an aid, feel free to use the following questions to help you generate content for your entries:

* What action or concept of significance, as related to the course, did you experience on this date?

On this date I learned how to use the dd(1), data dump utility.

* Why was this significant?

This is significant because with the usage of the dd(1) utility I can take data from a source file then deposite it in a destination file.

* What concepts are you dealing with that may not make perfect sense?

Concepts of this utility that do not make perfect sense is the syntax involved. The “if” and “of” that need to be implemented do not make a lot of sense to me.

* What challenges are you facing with respect to the course?

When to use this utility as opposed to using the pipe ( | ) utility.

Entry 10: April 6, 2012

As an aid, feel free to use the following questions to help you generate content for your entries:

* What action or concept of significance, as related to the course, did you experience on this date?

In the VI editor I learned how to change some certain syntax on a larger scale.

* Why was this significant?

This is significant because if you are trying to change multiple of the same words it be hassle just to find each showing of that word, while you could use “:/word” to change an existing word.

* What concepts are you dealing with that may not make perfect sense?

The syntax involved the cat | grep | sed | sed command.

* What challenges are you facing with respect to the course?

Writing proper scripts to complement the right criteria asked in the question.

Entry 11: April 16, 2012

As an aid, feel free to use the following questions to help you generate content for your entries:

* What action or concept of significance, as related to the course, did you experience on this date?

On this day I learned how to use the cut(1) utility productively to my uses.

* Why was this significant?

This is significant because this utility will help me cut out unnecessary information that I do not wish to look at, when viewing a string of data.

* What concepts are you dealing with that may not make perfect sense?

A concept that I am dealing with that does not make perfect sense is the sed(1) utility, more or less the syntax involved with the command.

* What challenges are you facing with respect to the course?

Some challenges that I am facing is using the the grep(1) head(1) and tail(1) all at once, but in useful manner.

Entry 12: April 16, 2012

As an aid, feel free to use the following questions to help you generate content for your entries:

* What action or concept of significance, as related to the course, did you experience on this date?

Learned how to change a file into something that is viewable upon different operating systems. Using the tr(1) utility helped me do this.

* Why was this significant?

This is significant reading a different operating systems file, such as mac o.s., is not possible upon a Unix system. Thus, we must change the file ending to do so.

* What concepts are you dealing with that may not make perfect sense?

Concepts that do not make perfect sense to me is the syntax involved with the tr(1) utility.

* What challenges are you facing with respect to the course?

Analyzing shell script logic.

unix Keywords

The UNIX Programming Environment: Assembler
Definition

An assembler is a program used for converting instructions written in low-level code into machine level code.

Demonstration

Demonstration of the chosen keyword.

lab46:~$ touch file.asm
lab46:~$ nasm -f bin file.asm -o file.o
lab46:~$ ls
file.asm
file.o
lab46:~$ 
The UNIX Programming Environment: Linker
Definition

A linker is a program used with a compiler or assembler to provide links to the libraries needed for an executable program.

Demonstration

Demonstration of the chosen keyword.

lab46:~$ ld -o fileA hello.o
lab46:~$ ls
lab46:~$
fileA
hello.o
Filtering
Definition

A piece of software that processes text, for example to remove unwanted spaces or to format it for use in another application.

Demonstration

Demonstration of the chosen keyword.

lab46:~$ touch apple.txt
lab46:~$ vi apple.txt
core worm seed jewel
lab46:~$ cat apple.txt core worm seed jewel lab46:~$ cat apple.txt | sed -e "s/e/WWW/" corWWW worm sWWWed jWWWwel lab46:~$ cat apple.txt | sed -e "s/e/J/g" corJ worm sJJd jJwJl
The UNIX Programming Environment: Source Code
Definition

A source code is a text listing of commands to be compiled or assembled into an executable computer program.

Demonstration

Demonstration of the chosen keyword.

lab46:~$ cat helloC.c
/*
 * helloC.c - a simple "Hello, World!" in C.
 *
 * To compile: gcc -o helloC helloC.c
 */

// include standard I/O functions
//
#include <stdio.h>

// main() function
//
int main()
{
 puts("Hello, World!\n");
 return(0);
}

lab46:~$
Pattern Matching
Definition

Act of checking some sequence of tokens for the presence of the constituents of some pattern

Demonstration

. Match any character

* Match 0 or more of the preceding

^ Beginning of line or string

$ End of line or string

[ ] Character class - match any of the enclosed characters

[^ ] Negated character class - do not match any of the enclosed characters

\< Beginning of word

\> End of word

lab46:~$ grep ^[b-d][aeiou] /etc/passwd
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
lab46:~$
Security
Definition

Procedures followed or measures taken to ensure safety

Demonstration
lab46:~$ id tedmist1 (username)
uid=5763(tedmist1) gid=5000(lab46) groups=1730(unix),5763(tedmist1),5000(lab46)
The UNIX Programming Environment: Library
Definition

A library is a collection of subroutines or classes used to develop software.

Demonstration

ar(1) - Maintain portable archive or library.

lab46:~$ ar cq lib.a *.o
lab46:~$ ls
lib.a
Syntax

ar [arguments] [ posname ] archive file. - Arguments can be found in the man pages of ar. Use man ar.

Some arguments include:

- c: create a new library

- q: add the named file to the end of the archive

- r: replace a named archive/library member

- t: print a table of archive contents

Regular Expressions
Definition

Regular expressions, also referred to as regex or regexp, are search criteria for text pattern matching that provide more flexibility than simple wild-card characters.

Demonstration

These Regular Expressions are as follows:

  1. . Match any character
  2. * Match 0 or more of the preceding
  3. ^ Beginning of line or string
  4. $ End of line or string
  5. [ ] Character class - match any of the enclosed characters
  6. [^ ] Negated character class - do not match any of the enclosed characters
  7. \< Beginning of word
  8. \> End of word
lab46:~$ grep ^[b-d][aeiou] /etc/passwd
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
lab46:~$

unix Objective

Understanding And Use Of Pattern Matching
Definition

Pattern matching is making use of a pattern, usually a regular expression, and trying the pattern various ways on a string to see whether there's any way to make it fit.

Method

The method of measurement will be the understand and how to successfully incorporate pattern matching expressions, such as the ones below.

Measurement

Follow your method and obtain a measurement. Document the results here. . Match any character

* Match 0 or more of the preceding

^ Beginning of line or string

$ End of line or string

[ ] Character class - match any of the enclosed characters

[^ ] Negated character class - do not match any of the enclosed characters

\< Beginning of word

\> End of word

By understanding and incorporating these expressions, you can successfully search through a file with ease to get a desired result.
Analysis

Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.

* How did you do?

Work in progress, as of right now, I am still learning how to use these.

* Is there room for improvement?

Yes.

* Could the measurement process be enhanced to be more effective?

In time, and the usage of these will making the learning of pattern matching that much easier.

* Do you think this enhancement would be efficient to employ?

Yes it would be efficient to employ when searching through a file for a desired result.

* Could the course objective be altered to be more applicable? How would you alter it?

No the course object is applicable to a student, such as I, situation involved Unix.

Experiments

Experiment 7

Question

Is there a command to search through all the one-line command descriptions, while looking for those that contain the same string of characters you specified.

Resources

Harley Hahn's Guide to Unix and Linux. Chapter 9: Documentation : The Unix Manual and Info.

Hypothesis

If there is a way to search through all the one-line command descriptions, while looking for those that contain the same string of characters you specified, then there is a command to do such things.

State your rationale.

My curiosity to search through a line of string of characters blindly for a desired result.

Experiment

How are you going to test your hypothesis? What is the structure of your experiment?

I am going to test my hypothesis by running the command with a certain file. The structure of this will be used within the syntax lines of apropos.

Data

Perform your experiment, and collect/document the results here.

Apropos's syntax is: apropos keywords
lab46:~$ apropos pstree
pstree (1)           - display a tree of processes
pstree.x11 (1)       - display a tree of processes

Analysis

Based on the data collected:

* Was your hypothesis correct?

Yes my hypothesis was correct

* Was your hypothesis not applicable?

My hypothesis was applicable * Is there more going on than you originally thought? (shortcomings in hypothesis)

The command gives a larger listing than I once thought.

* What shortcomings might there be in your experiment?

In need to use different keywords.

* What shortcomings might there be in your data?

Only the use of one keyword, pstree.

Conclusions

What can you ascertain based on the experiment performed and data collected? Document your findings here; make a statement as to any discoveries you've made.

Based on the data collected, and the experiment, the command apropos(1) can be used to find a listing of commands based upon a certain keyword. This command produced a longer listing of commands, based on the certain keyword, than I thought before the conducted experiment had happened.

Experiment 8

Question

Is there a way to show a process diagram that shows the connections between the files and the folders?

Resources

Harley Hahn's Guide to Unix and Linux. Chapter 26: Processes and Job Control.

Hypothesis

If there is a way to show a process diagram that shows the connections between the files and the folders then there must be a command to do so.

State your rationale.

A visual diagram to show the connections can be very helpful when trying to locate a certain item that can be linked.

Experiment

How are you going to test your hypothesis? What is the structure of your experiment?

I am going to test my hypothesis by running the command. The structure of my experiment will be just run the command and assess the result.

Data

Perform your experiment, and collect/document the results here. pstree (process tree): useful when you want to understand the relationships between processes.

lab46:~$ pstree
init-+-atd
     |-avahi-daemon---avahi-daemon
     |-cron-+-cron---sh---launchbot.sh---python---python---{python}
     |      |-cron---sh---sh---python---python---2*[{python}]
     |      |-cron---sh---botscript.sh---python---python---{python}
     |      |-cron---sh---sh---python---python---29*[{python}]
     |      `-cron---botstart.sh---python---python---{python}
     |-dbus-daemon
     |-dhclient
     |-3*[eggdrop]
     |-getty
     |-inetd
     |-links
     |-nscd---7*[{nscd}]
     |-ntpd
     |-nullmailer-send
     |-portmap
     |-python---python---{python}
     |-python---{python}
     |-rpc.idmapd
     |-rpc.statd
     |-36*[screen---bash---irssi]
     |-2*[screen---irssi]
     |-screen---bash---screen
     |-screen-+-bash
     |        `-bash---screen
     |-3*[screen-+-bash]
     |           `-bash---irssi]
     |-3*[screen---bash]
     |-screen-+-3*[bash]
     |        `-2*[bash---irssi]
     |-screen-+-bash---tar---tar---gzip
     |        `-bash---vim---{vim}
     |-screen---2*[bash]
     |-screen-+-bash---irssi
     |        `-bash
     |-screen-+-2*[bash---irssi]
     |        |-3*[bash]
     |        `-4*[bash---ssh]
     |-screen---5*[bash]
     |-screen---4*[bash---vi---{vi}]
     |-screen-+-bash---bash---ssh
     |        |-3*[bash]
     |        |-bash---vi---{vi}
     |        `-bash---irssi
     |-sshd-+-5*[sshd---sshd---bash]
     |      |-sshd---sshd---bash---pstree
     |      |-sshd---sshd---bash---screen
     |      `-sshd---sshd---bash---vim---{vim}
     |-syslog-ng---syslog-ng
     |-tfe---daemon
     `-udevd---2*[udevd]

Analysis

Based on the data collected:

* Was your hypothesis correct?

Yes, my hypothesis was correct.

* Was your hypothesis not applicable?

My hypothesis was applicable. * Is there more going on than you originally thought? (shortcomings in hypothesis)

The command produced a longer hierarchy list than I once thought.

* What shortcomings might there be in your experiment?

Only the production of a process tree in a single directory.

* What shortcomings might there be in your data?

Only the production of a process tree in a single directory.

Conclusions

What can you ascertain based on the experiment performed and data collected? Document your findings here; make a statement as to any discoveries you've made.

Based upon my experiment and data collected pstree can be a very helpful utility if trying to understand relationships between processes. Something that had surprised me was that there were a lot more processes going on that I thought would be.

Retest 3

Perform the following steps:

State Experiment

Reid Hensen Part 1: Experiment 2

http://lab46.corning-cc.edu/opus/spring2012/rhensen/start#experiment_1

“Can output redirection be used with aliases in order to easily create a log file from the output of a certain command?”

Resources

Evaluate their resources and commentary. Answer the following questions:

* Do you feel the given resources are adequate in providing sufficient background information?

No, since it was just one web page of information.

* Are there additional resources you've found that you can add to the resources list?

Harley Hahn's Guide to Unix and Linux. Chapter 24: Working with Directories.

* Does the original experimenter appear to have obtained a necessary fundamental understanding of the concepts leading up to their stated experiment?

Yes, he does.

Hypothesis

State their experiment's hypothesis. Answer the following questions:

“A log file is sometimes useful to keep a record of the output generated by the output of a command. However, this is really only useful when the output is added to the log file automatically, which is why I believe the use of the alias will be helpful. I think that setting an alias for the ls command that will redirect the output to a file will effectively keep a record of each output that command generates. This is not to say that the ls command is the most useful command to have a log file associated with, but the method can hopefully be used with other command that better lend themselves to having a log.”

* Do you feel their hypothesis is adequate in capturing the essence of what they're trying to discover?

Yes, I do.

* What improvements could you make to their hypothesis, if any?

Make it shorter and to the point.

Experiment

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

* Are the instructions correct in successfully achieving the results?

Yes, I got a similar results. User name changes.

* Is there room for improvement in the experiment instructions/description? What suggestions would you make?

No, this is a pretty straightforward experiment, no needs for change.

* Would you make any alterations to the structure of the experiment to yield better results? What, and why?

No alterations to be needed to yield better results.

Data

Publish the data you have gained from your performing of the experiment here.

lab46:~$ alias ls="ls | tee -a /home/tedmist1/log"

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 appeared.

* How about any sources of error?

No sources of error.

* Is the stated hypothesis adequate?

The stated hypothesis is adequate.

Conclusions

Answer the following:

* What conclusions can you make based on performing the experiment?

By conducting such an experiment my knowledge towards the ls command has increased. With the help of redirection of a file, such a task became that much easier.

* Do you feel the experiment was adequate in obtaining a further understanding of a concept?

I obtained a further understanding of the concept by conducting the experiment.

* Does the original author appear to have gotten some value out of performing the experiment?

Yes, they did seem to get some value out of performing the experiment.

* Any suggestions or observations that could improve this particular process (in general, or specifically you, or specifically for the original author).

No improvements to be made upon such an experiment.
opus/spring2012/tedmist1/part3.txt · Last modified: 2012/05/01 21:44 by tedmist1