User Tools

Site Tools


opus:spring2012:tedmist1:start

Todd Edmister's Spring 2012 Opus

Introduction

My name is Todd Edmister, and this is currently my second semester up at Corning Community College. I currently work at the Corning Wegmans, working at both the Front End, and at the Service Desk. I have been playing the bass guitar for about 2 years now, and I am in a band with a group of my friends, the band is called In Progress. I enjoy traveling whenever I get the chance too. The furthest place I have ever traveled to was Sao Paulo, Brazil back in the summer of tenth to eleventh grade. The reason behind going was behind a Corning Soccer fund raised trip to play against and be coached by professional Brazilian players.

Part 1

Entries

Entry 1: January 24, 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?
I learned how to use the ls utility.

* Why was this significant?

The significance of this is that I now know how to create a file listing within my current working directory.

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

The arguments to the ls utility.

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

Remembrance of all the commands that need to be used.

Entry 2: January 24, 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 use the man(Manual) utility.

* Why was this significant?

This is significant because the manual pages provides in depth information about the requested command or allows users to search for commands related to a particular keyword.

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

How to successfully use the man command.

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

Learning the arguments with certain commands.

Entry 3: February 8, 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 use the file command.

* Why was this significant?

This is significant because the file command tells me what type of file you are looking at is.

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

The arguments to the file command.

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

Dealing with compressed files, such as gzip.

Entry 4: February 8, 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 use the wc(Word Count) command.

* Why was this significant?

This is significant because it gives you a word,line, and character count within the certain file.

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

Options such as “head”, and “tail” to use them correctly.

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

Challenges that are facing me with respect to the course is using commands to a certain order.

Keywords

unix Keywords

Local Host

Definition

Definition (in your own words) of the chosen keyword.

Standard host name given to the address of the network interface.
Demonstration

Demonstration of the chosen keyword.

lab46:~$ netstat
Active Internet connections (w/o servers)
Proto Revc-Q Send-Q Local Address            Foreign Address       State
tcp   0      0      lab46.offbrone.la:60002  irc.offbyone.lan:ircd Established
lab46:~$ 

Remote Host

Definition

Definition (in your own words) of the chosen keyword.

A computer that is in a different location than your computer but which you can log on to from your computer.
Demonstration

Demonstration of the chosen keyword.

Step 1. On the local host

Type the following at the command line:

lab46:~$ xhost + Remote Host IP address < press return >

Step 2. Log on to the remote host

lab46:~$ telnet Remote Host IP address < press return >

Home Directory

Definition

Definition (in your own words) of the chosen keyword.

A directory owned by a user and dedicated to storage of the user's personal files.
Demonstration

Demonstration of the chosen keyword.

lab46:~$ 
lab46:~$ cd home
lab46:~/home$
lab46:~/home$ ls
tedmist1
lab46:~/home$
lab46:~/home$ cd .
lab46:~/home$
lab46:~/home$ cd .. 
lab46:~$ 

Current Working Directory

Definition

Definition (in your own words) of the chosen keyword.

The default directory of a process from which all relative path names are resolved.
Demonstration

Demonstration of the chosen keyword.

pwd (Print Working Directory): Displays the name of your working directory.
lab46:~$ 
lab46:~$ pwd
/home/tedmist1
lab46:~$ 

Regular Files

Definition

Definition (in your own words) of the chosen keyword.

A file that's not a directory, a device, a named pipe or socket, or a symbolic link.
Demonstration

Demonstration of the chosen keyword.

ls (List Files): Display information about the contents of a directory.

* Listing only of a few regular files in my personal directory.

lab46:~$ ls
count.c
courses.html
cs.html
display.c
dtypes.c
file.txt
lab46:~$ 

Directory Files

Definition

Definition (in your own words) of the chosen keyword.

A file that consists solely of a set of other files.
Demonstration

Demonstration of the chosen keyword.

ls (List Files): Display information about the contents of a directory.

* Listing only of Directory files in my personal directory.

lab46:~$ ls
Mail
Maildir
archives
cd
devel
home
lab2
ls
p
public_html
script
shell
src
src.bak
tedmist1
lab46:~$ 

Special Files

Definition

Definition (in your own words) of the chosen keyword.

A device file or special file is an interface for a device driver that appears in a file system as if it were an ordinary file.
Demonstration

Demonstration of the chosen keyword.

ls (List Files): Display information about the contents of a directory.

* Listing only of special files in my personal directory.

lab46:~$ ls
Maildir
motd
lab46:~$

File Manipulation

Definition

Definition (in your own words) of the chosen keyword.

The act of changing a file to your certain needs and or requirements.
Demonstration

Demonstration of the chosen keyword.

chmod (Change File Mode): Change permissions for a file.

- Syntax: chmod mode file… * Where mode is the new file mode, and file is the name of a file or directory.

The first number represents the permission for the userid that wons the files; the second number represents the permissions for the userids in the group; the third number the permissions for all the userids on the system.

6 = permissions for owner
0 = permissions for group
0 = permissions for all other userids
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use the following numeric value for the various permissions.

4 = read permission
2 = write permission
1 = execute permission
0 = no permission

Owner: read + write + execute = 4 + 2 + 1 = 7
Group: read + write = 4 + 2 + 0 = 6
Other: read = 4 + 0 + 0 = 4
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Owner Group Other Mode File
rwx = 7 | rwx = 7 | rwx = 7 | 777 | program.allusers
rwx = 7 | rwx = 7 | — = 0 | 770 | program.group
rwx = 7 | — = 7 | — = 0 | 700 | program.owner
rw- = 7 | rw- = 7 | rw- = 6 | 666 | text.allusers
rw- = 7 | rw- = 7 | — = 0 | 660 | text.group
rw- = 7 | — = 0 | — = 0 | 600 | text.owner
lab46:~$ 
lab46:~$ chmod 777 file.txt
lab46:~$ 
lab46:~$ ls 
file.txt (should be indicated as a changed file, a green coloration is used to indicate such things in Unix)
lab46:~$ 

unix Objective

Exposure to Command-Line Tools and Utilities

State the course objective

Exposure to command-line tools and utilities.
Definition

In your own words, define what that objective entails.

The objective entails that throughout the course you will gain some, if not a lot of knowledge around the basics of command-line interfaces and the utilities involved with the type of interface.
Method

State the method you will use for measuring successful academic/intellectual achievement of this objective.

The method of academic/intellectual achievement of this objective can only be done through the amount of usage(time) spent using a command line interface.
Measurement

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

This can be measured by how comfortable the user is with the language and syntax involved with CLI systems. The more commands you can remember the easier job it will be for the user to do his or her job.
Analysis

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

  • How did you do?
So far I am learning about CLI, there wont be a point in which I know everything about CLI. Theres always something to learn about the subject at hand.
  • Is there room for improvement?
Yes, there is always room for improvement.
  • Could the measurement process be enhanced to be more effective?
The more you use a CLI the more effective you will be as a user. Knowing the commands is only part of the job, but correct implementation is the hard part.
  • Do you think this enhancement would be efficient to employ?
Yes, broadening your horizon upon the multiple interfaces that computers can employ only make you a better end user.
  • Could the course objective be altered to be more applicable? How would you alter it?
The course object is applicable at the moment, so alterations to the objective are not needed in current time.

Experiments

Experiment 1

Question

What is the question you'd like to pose for experimentation?

Is there anyway of comparing two separate files?

Resources

Collect information and resources (such as URLs of web resources), and comment on knowledge obtained that you think will provide useful background information to aid in performing the experiment.

My information was provided from Harley Hahn's Guide To Unix and Linux, Chapter 17: Filters: Comparing and extracting.

Hypothesis

Based on what you've read with respect to your original posed question, what do you think will be the result of your experiment (ie an educated guess based on the facts known). This is done before actually performing the experiment.

If there is a way of comparing two different files, then there is a command to do such act.

State your rationale.

My rationale was provided from my curiosity in which of finding the differences between two files.

Experiment

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

I'm going to test my hypothesis by conducting an experiment using two different files, preferably text files. And using the “cmp” or “comm” commands to differentiate those two files.

Data

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

In my shell directory consisted multiple text files from a previous assignment. This worked perfectly for my experiment being conducted. Thus using the “comm” utility I conducted the experiment on multiple occasions. Once again the “comm” utility finds differences between the two files. Thus at the prompt it looked like this: lab46:~/shell$ comm file1 filea. Entering such command I got a return of “More text …”. This is because inside file1 consists the words “More text …” and filea is an empty file. Thus, the difference was “More text …” just as “comm” told me. Another showing of how “comm” works is that when trying to find the differences between file2 and fileZZZ using the utility “comm” was quite useful. Thus the command was “lab46:~/shell$ comm file2 fileZZZ”. The return of that command was “file1”, “file1234”. Thus the differences between those two files were “file1” and “file1234”.

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)
There was more to the return prompt than I originally thought.
  • What shortcomings might there be in your experiment?
The usage of only using two text files, rather than using other files types also.
  • What shortcomings might there be in your data?
My data is centered around two text files, though other file types can be used.

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.

My conclusions to this experiment is that it can be very helpful when comparing different files. Though questions did arise when conducting the experiment. For instance, can you compare different directories, not just files. And, is there a way of comparing more than just two files at once, possibly three if not four files at once.

Experiment 2

Question

What is the question you'd like to pose for experimentation? State it here.

Is there anyway you can combine multiple files, but save the output in a different file?

Resources

Collect information and resources (such as URLs of web resources), and comment on knowledge obtained that you think will provide useful background information to aid in performing the experiment.

My information was provide from Harley Hahn's Guide to Unix and Linux, Chapter 16: Filters: Introductions and Basic Operations.

Hypothesis

Based on what you've read with respect to your original posed question, what do you think will be the result of your experiment (ie an educated guess based on the facts known). This is done before actually performing the experiment.

If it is possible to combine multiple files, but save the output in a different file, then file management will be a much smaller and easier process.

State your rationale.

My rationale was that of in which I was curious that in Unix there was a way of combining multiple files into one.

Experiment

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

Im am going to test my hypothesis by using the same files, and directory, as in experiment one (~/shell$). And I am planning on copying multiple files and combining them all into a seperate file within that directory. This can be done using the cat command.

Data

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

Doing this experimented was conducted using the cat command, under the syntax of “cat file file2 file3 > file4”. Thus, my syntax looked very similar to that, considering I had similar file names. My command looked like “lab46:~/shell$ cat file1 file2 file3 > fileC”. I copied all the text files into a new file called “fileC”. When listing the files in the directory using the ls command it was clear I had created the “fileC” file. Though, did everything copy into it? Using the cat command once again I looked the file. Using the command “cat fileC” I could see what “fileC” contained. After running the program it had given me a return of “More text …”, “file1”, and “file1234”. This clearly showed that when I had copied all those files previously that the contents also copied over into the new “fileC” file. Thus, the cat program ran correctly as planned.

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)
Using file system converters like > was unexpected before I had conducted the experiment.
  • What shortcomings might there be in your experiment?
Shortcomings that might be in my experiment is that I only used a certain type of file was used, text files.
  • What shortcomings might there be in your data?
Shortcomings that might be in my data is that I only used a certain type of file was used, text files.

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.

My conclusions for this experiment is that it can be very helpful when trying to clear up a directory. Making the directory look a lot nicer by combining files into one. Though the cat command used in this experiment is not the only once you could use, there are other available at your disposal.

Experiment 3

Question

What is the question you'd like to pose for experimentation? State it here.

Is there a way of converting a certain text file into octal and or hexadecimal format?

Resources

Collect information and resources (such as URLs of web resources), and comment on knowledge obtained that you think will provide useful background information to aid in performing the experiment.

My information came from Harley Hahn's Guide to Unix and Linux, Chapter 21: Displaying Files: Binary, Octal and Hexadecimal.

Hypothesis

Based on what you've read with respect to your original posed question, what do you think will be the result of your experiment (ie an educated guess based on the facts known). This is done before actually performing the experiment.

If there is a text file within a directory, then there is a way to convert that text file into octal and or hexadecimal format.

State your rationale.

My rationale was that of the curiosity in which if it was possible to convert a text file into octal and or hexadecimal format.

Experiment

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

I am going to test my hypothesis by converting simple text files over into octal and hexadecimal format. This will be done using the commands “od” (octal dump), and “hexdump” (hexadecimal dump), and text files within the shell directory.

Data

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

Running the commands “od” and “hexdump” on both the files “file1” and “file2” within the directory ~/shell$. Thus the commands looked like this: “od file1”, “hexdump file1”, and “od file2”, “hexdump file2”.
My data for this experiment went as followed:

“od file1”: → 0000000 067515 062562 072040 074145 020164 027056 005056005012 0000020 072012 064541 005154 0000026

“hexdump file1”: → 000000 6f4d 6572 7420 7865 2074 2e2e 0a2e 0a0a 0000010 740a 6961 0a6c 0000016

“od file2”: → 0000000 064546 062554 005061 064546 062554 031061 032063 000012 0000017

“hexdump file2”: → 0000000 6966 656c 0a31 6966 656c 3231 3433 000a 000000f

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 experiment went as planned, no unexpected occurrences happened.
  • What shortcomings might there be in your experiment?
Shortcomings in my experiment would be that I had only used text files rather than using other file types.
  • What shortcomings might there be in your data?
Shortcomings in my data would be that I had only used text files rather than using other file types.

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.

My conclusions on this experiment is that these commands can be very helpful if that you are looking the view the octal and or hexadecimal values of a certain text file. Though during this experiment I wondered that are the “od” and “hexdump” commands limited to just text files? Can they unwind other file types into their decimal values?

Part 2

Entries

Entry 5: March 2, 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 file permissions, using chmod command.

* Why was this significant?

This is significant because it lets you change the file to what you want it to be. For instance if the file is read only, you could possible change that so you can also write to the file.

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

The numbering systems involved with chmod.

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

Remembrance off all the chmod possibilities involved with file changes.

Entry 6: March 7, 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 display currently running processes, using the ps(1) command.

* Why was this significant?

The significance of this is that it tells you what programs are running at the current moment, and their computing information, such as PID's and CPU usage.

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

Arguments to the ps(1) command.

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

Using the cron command.

Entry 7: March 13, 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 compile/assemble source files into executables.

* Why was this significant?

This is significant because now I can run C code from an executable file.

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

Arguments involved with gcc/g++ compilers.

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

Creating files that need to be compiled at a later date.

Entry 8: March 9, 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 use the grep command.

* Why was this significant?

This is significant because the grep command will find text within a certain file for you.
  • What concepts are you dealing with that may not make perfect sense?
Using wildcard helpers with grep.

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

The usage of wildcards to have successful data results.

Keywords

unix Keywords

Text Processing

Definition

Definition (in your own words) of the chosen keyword.

The creation and manipulations of a file.
Demonstration

Demonstration of the chosen keyword.

lab46:~$ 
lab46:~$ cat > file.c
Any text can go here
^D (command to end operation)
lab46:~$ 
lab46:~$ cat file.c
Any text can go here
lab46:~$ 

The VI Editor

Definition

Definition (in your own words) of the chosen keyword.

Screen-oriented text editor originally created for the Unix operating system.
Demonstration

Demonstration of the chosen keyword.

Lets use file.c from the previous topic.

Syntax: vi [-rR][file…]

Exiting and Entering VI:

ZZ save file and exit VI
:wq same as above
:e! return to last saved version of current file
:q quit without save, (Note :q! is required if changes have been made)
:w write without exit (:w! to force write)
lab46:~$ vi file.c
* enters VI program

Any text can go here
~
~
"file.c" 2L, 22C                 1,1    ALL
:q
lab46:~$

The Unix Shell: Environment Variable

Definition

Definition (in your own words) of the chosen keyword.

Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer.
Demonstration

Demonstration of the chosen keyword.

Environment Variables include:
USER (your login name)
HOME (the path name of your home directory)
HOST (the name of the computer you are using)
ARCH (the architecture of the computers processor)
DISPLAY (the name of the computer screen to display X windows)
PRINTER (the default printer to send print jobs)
PATH (the directories the shell should search to find a command)

env: Display environment variables.

lab46:~$ env
Term=xterm
SHELL=/bin/bash
SSH_CLIENT=67.252.199.108 61408 22
SSH_TTY=/dev/pts/74
USER=tedmist1
MAIL=/home/tedmist1/Maildir
PATH=/usr/lcoal/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
LC_COLLATE=C
PWD=/home/tedmist1
HISTCONTROL=ignoreboth
SHLVL=1
HOME=/home/tedmist1
LOGNAME=tedmist1
SSH_CONNECTION=67.252.119.108 61408 10.80.2.38 22
_=/usr/bin/env
OLDPWD=/usr/local/bin
lab46:~$

The UNIX Shell: $PATH

Definition

Definition (in your own words) of the chosen keyword.

PATH is an environment variable on Unix-like operating systems. This path specifies a set of directories where executable programs are located.
Demonstration

Demonstration of the chosen keyword.

Examples of SHELL variables are:

cwd (your current working directory)

home (the path name of your home directory)

path (the directories the shell should search to find a command)

prompt (the text string used to prompt for interactive commands shell your login shell)

SHELL variables are both set and displayed using the set command.
lab46:~$ set
BASH=/bin/bash
HOME=/home/tedmist1
LOGNAME=tedmist1
PWD=/home/tedmist1
SHELL=/bin/bash
USER=tedmist1
lab46:~$

The UNIX Shell: Wildcards

Definition

Definition (in your own words) of the chosen keyword.

A special character usually used in the middle of a search term in a keyword search to retrieve results containing words with any character or no character in the position.
Demonstration

Demonstration of the chosen keyword.

Syntax:
? Matches any one character in a filename.
* Matches any character or characters in a filename.
[ ] Matches one of the characters included inside the [ ] symbols.
lab46:~$ 
lab46:~$  cd script
lab46:~/script$ ls
file1 file2 file3 file4 file5 file6 file8 script8 typescript
lab46:~/script$ ls file?
file1 file2 file3 file4 file5 file6 file7 file8
lab46:~/script$ ls file*
file1 file2 file3 file4 file5 file6 file7 file8
lab46:~/script$ ls [f]*
file1 file2 file3 file4 file5 file6 file7 file8
lab46:~/script$

The UNIX Shell: Tab Completion

Definition

Definition (in your own words) of the chosen keyword.

Tab completion is a common feature of command line interpreters, in which the program automatically fills in partially typed commands.
Demonstration

Demonstration of the chosen keyword.

Changing directories into your home directory.

If you haven't provided unique enough information to the command-line, the tab completion cannot complete. Hitting tab a second time will give you a list of possible choices.
lab46:~$ cd ho <-- hit tab
lab46:~$ cd home/ <-- this is what should appear after hitting the tab command
<hit return>
lab46:~/home$
lab46:~$ cd home/ <-- if you hit the tab command twice the next prompt should appear:
lab46:~$ cd home/
.swp    username/

Job Control

Definition

Definition (in your own words) of the chosen keyword.

The ability to suspend an interactive job and resume it at a later time, or send it into the “background”.
Demonstration

Demonstration of the chosen keyword.

Need to know information:

Process ID (PID): a unique number assigned to each running process on the system.
Foreground Process: a process that is running in the foreground (currently using STDIN/STDOUT/STDERR).
Background Process: a process that is running independently in the background, allowing you to use your shell (which is in your foreground) or start additional applications.
Killing a Process: in UNIX, you can terminate processes with the kill(1) utility.
The ps(1) utility is used to list the running processes on the system. Running with no arguments will show the current processes attached to your login session.

The kill(1) utility is used to terminate certain PID numbers running.
lab46:~$ ps
USER      PID    %CPU %MEM VSZ    RSS   TTY     STAT START  TIME COMMAND
tedmist1  13123  1.0  0.1  13628  1956  pts/74  SNs  12:53  0:00  -bash
tedmist1  13126  0.0  0.0   8588   996  pts/74  RN+  12:53  0:00  ps u
lab46:~$ kill 13123
lab46:~$

The UNIX Programming Environment: Compiler

Definition

Definition (in your own words) of the chosen keyword.

A program that decodes instructions written in a higher order language and produces an assembly language program.
Demonstration

Demonstration of the chosen keyword.

The Unix command for compiling C/C++ code is gcc.
Where hello is the name of the desired executable, and hello.c is the name of the text file containing the program source.
The -o argument to gcc indicates the name of the output file.
C Compiler
lab46:~$ gcc -o hello hello.c
lab46:~$ ls
hello (green coloration indicating it as a special file)
hello.c
lab46:~$
C++ Compiler
Where hello1 is the name of the desired executable, and hello.cc is the name of the text file containing the program source.
The -o argument to g++ indicates the name of the output file.
lab46:~$ g++ -o hello1 hello.cc
lab46:~$ ls
hello1 (green coloration indicating it as a special file)
hello.cc
lab46:~$

unix Objective

The Ability to Accomplish/Automate Tasks

State the course objective

The ability to accomplish/automate tasks
Definition

In your own words, define what that objective entails.

The ability to create ones own task, and have it run at a certain point of time on each day you so wish it to run.
Method

State the method you will use for measuring successful academic/intellectual achievement of this objective.

Such an objective can be accomplished using the cron command. Cron the name of a program that enables Unix users to execute commands or scripts automatically at a specified time/date.
 *     *     *   *    *        command to be executed
 -     -     -   -    -
 |     |     |   |    |
 |     |     |   |    +----- day of week (0 - 6)
                                           (Sunday=0)
 |     |     |   +------- month (1 - 12)
 |     |     +--------- day of month (1 - 31)  
 |     +----------- hour (0 - 23)
 +------------- min (0 - 59)
Measurement

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

The method of measurement would be the times in which your task will be occurring. If the task only runs for a week the measurement of that task will be a week.
Analysis

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

  • How did you do?
Good, in this objective I learned how to automate tasks to my wanting.

* Is there room for improvement?

Yes, by learning all the commands and proper syntax involved.

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

No, it will just take time to learn such things.

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

Yes, by running tasks on certain days, thus you would not forget to run them on that day.

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

The course objective is just fine the way it is. It is already applicable, thus no changes needed to be made.

Experiments

Experiment 4

Question

What is the question you'd like to pose for experimentation? State it here.

Is there anyway display commands from a history list and then re execute a command from the history list?

Resources

Collect information and resources (such as URLs of web resources), and comment on knowledge obtained that you think will provide useful background information to aid in performing the experiment.

My information came from Harley Hahn's Guide to Unix and Linux, Chapter 13: Using the Shell: Commands and Customization.

Hypothesis

Based on what you've read with respect to your original posed question, what do you think will be the result of your experiment (ie an educated guess based on the facts known). This is done before actually performing the experiment.

If there is a way to display commands from a history list, then I can re execute those commands from the history list using another command.

State your rationale.

My rationale involving my experiment was that of the curiosity in which I could look back in time to see what commands I have used.

Experiment

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

During this experiment I will be running the command, “history”, to display commands from the history file. From there I will be the commands “!” and “!!” to perform different needed tasks. The command “!” will re execute a certain command number from the history list. While, “!!” will re execute the last command used from the history list.

Data

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

When running the “history” I get a listing from the command numbers used of 321 to my most current command 533 or history. If I run the “!” command, for example of line 521, which was a “ls” command used earlier. The prompt would look like this “!521”, thus if done right an listing of files should have appeared in your home directory, just as the ls was directed for earlier. The format for the “!” goes as the following “!filename”. Since the “!!” will re execute the last command in the history list, the same ls should appear if you had used the “!!” command. If all completed right you would have two file listings of your home directory in visible sight.

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 worked just as I thought it would have.
  • What shortcomings might there be in your experiment?
There are no foreseen shortcomings in my experiment.
  • What shortcomings might there be in your data?
There are no foreseen shortcomings in my data.

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.

In conclusion using the history command can be very useful if you had forgotten a certain command used a while back. Also the “!” command can be a quick way to use that same forgotten command if you don't want to retype out that command.

Experiment 5

Question

What is the question you'd like to pose for experimentation? State it here.

Is there a way to run programs at a lower priority in comparison to other programs running?

Resources

Collect information and resources (such as URLs of web resources), and comment on knowledge obtained that you think will provide useful background information to aid in performing the experiment.

My information came from Harley Hahn's Guide to Unix and Linux, Chapter 26: Processes and Job Control.

Hypothesis

Based on what you've read with respect to your original posed question, what do you think will be the result of your experiment (ie an educated guess based on the facts known). This is done before actually performing the experiment.

If there is a way to run programs at a lower priority then what command can be used to do such actions.

State your rationale.

My rationale for this question is that when running multiple commands, how can you prioritize which needs more priority over the other.

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 a command and setting it to run in the background. Then run another program. Using the ps utility check out the %CPU usage for the commands used. And hello and hello2 as the desired executable. I will be using the files hello.c and count.c as the files with the program source code.

Data

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

To run programs at a lower priority use nice(1).
Syntax: nice [-n adjustment] command.
However, nice will not automatically run the program in the background. You will need to do that yourself by typing an & character at the end of the command.
lab46:~$ nice gcc -o hello hello.c &
[1] 13842
lab46:~$ gcc -o hello2 count.c
lab46:~$ ps
USER      PID    %CPU %MEM VSZ    RSS   TTY     STAT START  TIME COMMAND
tedmist1  13123  1.0  0.1  13628  1956  pts/74  SNs  12:53  0:00  -bash
tedmist1  13955  0.0  0.0   8588   996  pts/74  RN+  14:07  0:00  ps u
tedmist1  13465  2.0  0.1   9525   992  pts/74  RN+  14:07  0:00  nice gcc -o hello hello.c &
tedmist1  13812  1.1  0.0   8678   994  pts/74  RN+  14:07  0:00  gcc -o hello2 count.c

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)
More commands were needed to be used than I originally thought I had to use.
  • What shortcomings might there be in your experiment?
I had only ran two programs while there could have been more

programs running at once, thus making my experiment more applicable.

  • What shortcomings might there be in your data?
I used the gcc compiler only, I could have used the g++ compiler. Possibly could have gotten different results, thus different data.

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.

From my experiment, provided above, I can say that I know now how to set commands, while running in the background, to a lower priority over other commands running. This can be very helpful if you have a program that can run in the background and which uses a large amount of CPU time. Using the nice(1) utility provides that the program have a reduced amount of CPU usage. Thus, leaving other programs to use that CPU speed.

Retest 2

Perform the following steps:

State Experiment

Whose existing experiment are you going to retest? Provide the URL, note the author, and restate their question.

I will be retesting Reid Hensen's Experiment 3 in Part One.

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

Question: Is it possible to remove a directory by deleting the . file that is contained within the directory?

Resources

Evaluate their resources and commentary. Answer the following questions:

  • Do you feel the given resources are adequate in providing sufficient background information?
I do not, no resources were provided for the experiment.

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

I would add Chapter 25: Working with Files, found in Harley Hahn's Guide to Unix and Linux.

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

Yes, I do believe the original experimenter appeared to have an understanding of the concepts prior their experiment.

Hypothesis

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

Their experiment's hypothesis: “Each directory contains two files which are ”.” and ”..”. The . file refers to the directory itself and the .. file refers to the parent of that directory. These files are in each directory to allow the Unix shell to use relative path names. I believe that if the . file is removed, this would logically cause the current working directory to be deleted. It would seem to be a problem if Unix allowed the user to do this, which is why I believe that removing directories cannot be done in this way.”
  • Do you feel their hypothesis is adequate in capturing the essence of what they're trying to discover?
Yes, I do believe so.

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

Make it shorter and to the point. No need for a lengthy hypothesis.

Experiment

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

  • Are the instructions correct in successfully achieving the results?
Yes, the instructions are correct in achieving the results.

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

No, the instructions are straight forward and easy to follow.

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

No, I would not do so because there is no changing what the experiment can entitle. Different results are not obtainable for this experiment.

Data

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

lab46:~/test$ rm .
rm: cannot remove `.': Is a directory
lab46:~/test$ rmdir .
rmdir: failed to remove `.': Invalid argument

Analysis

Answer the following:

  • Does the data seem in-line with the published data from the original author?
Yes, the data is in-line with the published data from the original author.

* Can you explain any deviations?

No deviations in data.

* How about any sources of error?

No sources of error, besides the ones in experiment.

  • Is the stated hypothesis adequate?
The stated hypothesis is adequate.

Conclusions

Answer the following:

  • What conclusions can you make based on performing the experiment?
The started hypothesis was correct on the results of the experiment.

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

No, no further knowledge was learned from this experiment.

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

The knowledge that you cannot remove your current working directory.

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

No suggestions to be made or needed in this experiment.

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/start.txt · Last modified: 2012/08/19 20:24 by 127.0.0.1