User Tools

Site Tools


opus:fall2011:vcordes1:part1

Part 1

Entries

September Something early in September, 2011

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

The File system.

  • Why was this significant?

With 99% of everything in a Unix system being a file it is important to know how they work, how to find them, and how to modify them.

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

You cannot execute or open a file without being in the directory the file is in, or making a path to it. This is understandable, it is just slightly annoying.

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

For some reason I am having the most ridiculously difficult time moving files through directories.

September 15?, 2011

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

I experienced Shell Scripting.

  • Why was this significant?

This is a very powerful tool that can be used effectively with a Unix/Linux system.

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

The concepts make sense as the CLI simply reads and performs the script line by line.

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

As far as writing a shell script is concerned I need to learn more about the functions of quotations, back ticks, parentheses to be more effective and create more complex scripts.

August 30, 2011

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

The CLI

  • Why was this significant?

It is how things get done.

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

How a CLI could be more efficient, and more powerful (why use it at all?) than a GUI.

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

I have no prior experience with a CLI and I have a lot to learn to become efficient.

September 21, 2011

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

I experienced the awesome that is multitasking on Ubuntu

  • Why was this significant?

Linux systems are designed to multitask and it is appropriate for me to finally take advantage of it. It is extremely useful to have the ability to switch work spaces with the click of a button. I hooked up a monitor to my laptop to more effectively use this feature, giving me eight work spaces.

Topics

Backgrounding a process

Allows a process to operate while freeing up your terminal. This can be done using bg or &. In addition the process must be able to run in the background.

lab46:~$ bg PID
lab46:~$ ./test &

Forgrounding a process

Brings a process operating in the background to the terminal. Use fg to forground a process.

lab46:~$ fg PID

Killing a process

Sends a signal to stop or terminate a process. Killing can be done in a number or ways commands consist of k -0 to -64. Kill usually works in conjunction with the PID (process id) which can be determined using ps. ctrl+c will work to terminate a task in many cases See man page for more. (man kill)

lab46:~$ kill -9 PID

The Vi Editor

A text editor that is built in to nearly every Unix system. It as different modes consisting of “insert, command, and extended command.” Bi was developed to be efficient and used without a mouse Vi automatically starts in command mode. To enter Vi use vi filename. See http://adminschoice.com/vi-editor-quick-reference for more on Vi.

lab46:~$ vi test

Insert mode

Insert mode allows for text input. There are various methods to enter insert mode. “i, a, A” keys from command mode are just a few. Note that each of these will put you in insert mode at a different point in the text. Follow the link under The Vi Editor for more.

Command Mode

Command mode permits the use of commands within the vi text editor. Use escape to enter command mode. The majority of keys (on the keyboard) are bound to some command. It allows for quick editing of text without a mouse. You can also use a number before some commands to move multiple lines, delete or copy multiple lines, etc. See the link under the Vi Editor for more.

Examples: u = undo dd = deletes a line i = enters insert mode h, j, k, l = move the cursor right, down, up, left

Extended Command Mode

Extend command mode can be used to enter script like commands. To enter extended command mode, from command mode press : (that's colon) This is useful for copying or editing multiple lines at one time. For more on extended command mode see http://www.eng.hawaii.edu/Tutor/vi.html#s-excmd or http://www.uic.edu/depts/accc/software/unixgeneral/vi101.html#introvi

Files

Files are how data in Unix is represented. Fall into one of the three Unix philosophies “everything is a file” this holds true for nearly everything in Unix. Files can be manipulated, executed, used to store data, moved, renamed, replaced, copied, deleted etc. (Given that you have the permissions.) You can create regular files with touch filename, directories can be created with mkdir filename.

Listing

Listing files can be done with ls. It is necessary to be able to view the files within a directory in order to manipulate them or navigate through the file system. Hidden files or files that begin with a . can be viewed by using ls -a. For more on ls see man ls.

lab46:~$ ls
lab46:~$ ls -a

Permissions

Permissions dictate who can do what with files. Permissions can be set with chmod. Permissions consist of read write and execute. They can be set for user, group and other. Man chmod for more also see http://www.perlfect.com/articles/chmod.shtml

lab46:~$ chmod 700 test
lab46:~$ chmod 755 test

Viewing

To see the contents of a file (provide you have the permissions) you can open the file with a text editor (vi, nano, etc). It is also possible to see the contents of a file without opening it in a text editor. To do this you can use cat or if you are looking for something specific grep. See man cat and man grep for more.

lab46:~$ cat test
lab46:~$ grep this test
this is a test
lab46:~$

Multitasking

Unix was developed with the idea of multitasking in mind. The Unix system can be easily used to run multiple processes at one time. Multitasking can be accomplished with the use of multiple terminals, foregrounding backgrounding, and workstations. It is one of the core advantages to using a Unix system.

Objectives

Objective 1

Exposure to open source concepts and ideals.

Method

I will download and install Ubuntu, in addition to applications for the operating system. In addition to reading Harley Hans guide to Unix Linux and learning about the principals Linux systems are based on.

Measurement

While downloading Ubuntu (free) and some applications after the installation (Emacs to use as an example, also free)I have gotten fair grasp of open source concepts.

Analysis

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

  • How did you do?

I would say over all I did fairly well. I understand that the important ideal behind open source is not that it is necessarily free but that it can be modified to suit a users need, and that a collaborated effort between an unlimited amount of programmers can make software all around better, faster.

  • Room for improvement?

I could improve upon these concepts by contributing to the collective effort. For example creating software for others to use and improve upon.

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

The process could be extended upon, perhaps by more research into open source, or downloading multiple versions of free Linux.

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

This enhancement would be relatively inefficient as it is more of a time consuming project that wouldn't necessarily result in learning anything new.

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

Perhaps by adding a requirement that students make a direct contribution to the open source ideals of some sort (software, knowledge, etc) but that is already tied in somewhat via the opus.

Experiments

Experiment 1

Question

Can I write a Script in Emacs from the desktop and run it in a terminal?

Resources

No real resources necessary just Emacs and some knowledge of scripting.

Hypothesis

I believe it will work due to the fact that I can run Emacs from a terminal in addition to using it from the desktop shortcut.

Experiment

I am going to write a small script in Emacs from the desktop and open a terminal to see if it will run.

Data

In Emacs

#!/bin/bash

echo -n “enter a number: ”

read number

let a=number+3

In terminal

chmod 700 test

./test

Analysis

Based on the data collected:

  • was your hypothesis correct?

Yes it worked, I entered a number and it added 3 to that number.

  • is there more going on than you originally thought? (shortcomings in hypothesis)

No everything is as it should be.

  • what shortcomings might there be in your experiment?

Nothing that I can think of for what I was trying to test.

  • what shortcomings might there be in your data?

My data is sound.

Conclusions

I can say that even with the use of a GUI as opposed to a straight CLI applications will work properly in both/on both/with both.

Experiment 2

Question

When multiple processes are running in the background, if you foreground simply fg which one will foreground.

Resources

No necessary resources just knowledge of how to use bg and fg. The use of ps is also necessary.

Hypothesis

I believe that the process listed at the bottom of the background processes will be the one to come to the foreground. This is really just guess. It would make the most sense without actually knowing what will happen.

Experiment

I am going to but a number of processes in the background, run ps to see the list, then run fg. After this I will run ps again to see what process comes to the foreground as I will be using xeyes multiple times. I will repeat this until I can determine what actually is happening.

Data

While performing my experiment I initially thought that my hypothesis was correct as the process to foreground was the last process on the list when I ran a ps. However it was also the last process to be sent to the background. I brought other processes to the foreground and found that the last process to be sent to the background (the most recent process in the foreground) would be the one to return to the foreground when performing just fg.

Analysis

Based on the data collected:

  • was your hypothesis correct?

No it was not.

  • was your hypothesis not applicable?

Yes it was applicable, just not correct.

  • is there more going on than you originally thought? (shortcomings in hypothesis)

Not really more it just functions differently that I thought it would.

  • what shortcomings might there be in your experiment?

I could probably try with more than just xeyes to see if there is some sort of priority based on a different process.

  • what shortcomings might there be in your data?

If I didn't run the experiment enough times the data could be wrong.

Conclusions

I can say after performing the experiment a number of times that the process that will foreground if you are just doing a fg with no modifications to it will be the last process to be sent to the background.

Experiment 3

Question

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

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.

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.

State your rationale.

Experiment

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

Data

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

Analysis

Based on the data collected:

  • was your hypothesis correct?
  • was your hypothesis not applicable?
  • is there more going on than you originally thought? (shortcomings in hypothesis)
  • what shortcomings might there be in your experiment?
  • what shortcomings might there be in your 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

opus/fall2011/vcordes1/part1.txt · Last modified: 2011/12/18 04:49 by vcordes1