Table of Contents
Vincent Cordes Fall 2011 Opus
OPTIONAL SUBTITLE
Introduction
This is the revamped introduction.
There is gonna be some stuff and things throughout this opus.
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
Part 2
Entries
October 16, 2011
- What action or concept of significance, as related to the course, did you experience on this date?
I played with and experienced the C and C++ programming languages.
- Why was this significant?
This is significant as C is important within the UNIX environment. It was an awesome experience. I learned that I can write a program in C or C++ and execute that program from a shell script and then further manipulate the data.
October 19, 2011
- What action or concept of significance, as related to the course, did you experience on this date?
I got to experience what can happen when you try to alter something and don't properly research it first.
- Why was this significant?
It is an important lesson to learn as in the future I may actually have important things on a system that I have control of and breaking it would cause actual problems.
- What concepts are you dealing with that may not make perfect sense?
I don't exactly understand what pulgins are or what they do.
- What challenges are you facing with respect to the course?
I don't know how to fix what I did and I think that would be important in the grand scheme of things.
October 42, 2011
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 played around with the command apt-get install
- Why was this significant?
It is an effective way to acquire things from the great internet via a CLI.
- What concepts are you dealing with that may not make perfect sense?
Everything makes sense with this command
- What challenges are you facing with respect to the course?
It is incredibly annoying to download via apt-get install if you do not know the specific name of the package you want
October 98271, 2011
Back in the month of beginning…as it was the beginning month I wish I had known about this
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 about PINE.
- Why was this significant?
It makes e-mail much easier to access
- What concepts are you dealing with that may not make perfect sense?
Myself as I had know that there is no way e-mail has to be opened the hard way and I could have asked a question anytime
- What challenges are you facing with respect to the course?
I know some things can be done, I think some things can be done, and I assume some things can be done.
unix Topics
Wildcards
Wildcards are used in the manipulation and management of files.
lab46:~$ cd src lab46:~/src$ gcc -o hello hello.c lab46:~/src$ ./hello Hello, World! lab46:~/src$
Local Host
Is the server that you are operating from should you be at that servers location. For example, working on the lab46 server while in the lair.
lab46:~$ cd src lab46:~/src$ gcc -o hello hello.c lab46:~/src$ ./hello Hello, World! lab46:~/src$
Remote Host
Is the server you are operating from should you not be at that location. For example working on lab46 from home via putty or or some version of linux.
/* * Sample code block */ #include <stdio.h> int main() { return(0); }
Shell Scripting
Is the act of entering command lines into a text editor to be run by the shell when executed.
lab46:~$ cd src lab46:~/src$ gcc -o hello hello.c lab46:~/src$ ./hello Hello, World! lab46:~/src$
C
Is one of the most important programming languages in existence. C is widely used across numerous platforms for an uncountable number of things.
/* * Sample code block */ #include <stdio.h> int main() { return(0); }
Current Working Directory
In a nutshell the directory you are currently working in.
lab46:~$ cd src lab46:~/src$ gcc -o hello hello.c lab46:~/src$ ./hello Hello, World! lab46:~/src$
Regular Expressions
Regular expressions are used for the manipulation of test. They can be used to filter, alter, etc.
/* * Sample code block */ #include <stdio.h> int main() { return(0); }
X Window System
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
If you want to demonstrate something on the command-line, you can do so as follows:
lab46:~$ cd src lab46:~/src$ gcc -o hello hello.c lab46:~/src$ ./hello Hello, World! lab46:~/src$
The UNIX Shell
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:
/* * Sample code block */ #include <stdio.h> int main() { return(0); }
Compiler
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
If you want to demonstrate something on the command-line, you can do so as follows:
lab46:~$ cd src lab46:~/src$ gcc -o hello hello.c lab46:~/src$ ./hello Hello, World! lab46:~/src$
Assembly
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:
/* * Sample code block */ #include <stdio.h> int main() { return(0); }
Removing
From the file context. Is the removing/deleting of a file. This can be done through the use of rm.
lab46:~$ rm filename
unix Objective
Objective
Exposure to command-line tools and utilities.
Method
I will be measuring this objective through my ability to use the CLI.
Measurement
Throughout the course I have been becoming more proficient using the CLI. When the course began I didn't know anything, (to the point where I couldn't touch a file) now I can do anything from the CLI that I can do from a GUI. (If I can't I at least know where to look to figure it out)
Analysis
Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.
- How did you do?
Fairly well I can work with a CLI infinitely better than when I began.
- Room for improvement?
There are some things that I still have to think about and with Linux systems I would argue that since no one person knows everything there is to know there is always room for improvement.
- Could the measurement process be enhanced to be more effective?
Perhaps with a written test on the use of various commands and tools provided by the CLI. Asking questions like what can you use for arithmetic? and What would you enter to find the answer to 392385 * 239823? (The experiments and projects performed in the course are a far better test than a test could ever be, so if my opinion matters my method of measurement is better.)
- Do you think this enhancement would be efficient to employ?
Yes because with a test of this sort it could be efficiently graded via a shell script, and broken down in a matter of seconds to find out what areas a student may know or may need improvement in.
- Could the course objective be altered to be more applicable? How would you alter it?
Honestly I would leave it as it is.
Experiments
Experiment 1
Question
Can I get a three dimensional desktop layout for Ubuntu? (aka really cool looking pimped out desktop)
Resources
Download compiz.
Hypothesis
I believe that I can figure out how to alter my desktop with the use of compiz with relative ease.
Experiment
I am going to run compiz and check boxes that seem like they will do what i am looking for.
Data
I checked some boxes that seemed like they would give me the appearance I wanted (“cube”) and in order to do this plugins were disabled. I effectively ignored all warnings and proceeded.
Analysis
Based on the data collected:
- was your hypothesis correct?
No my hypothesis was dead wrong
- was your hypothesis not applicable?
Perhaps not I really have no understanding as to how compiz works, just what it is supposed to do. I should have looked into it before diving in.
- is there more going on than you originally thought? (shortcomings in hypothesis)
Probably….once again should have gotten a manual.
- what shortcomings might there be in your experiment?
Research…research….research.
- what shortcomings might there be in your data?
I reiterate, research as opposed to the download and click away strategy.
Conclusions
I can honestly say that there are some things that shouldn't be attempted without a manual or tutorial. My window manager was messed up beyond repair even before doing my next experiment I was looking into a re-install of Ubuntu.
Experiment 2
Question
What what will happen if I run sudo rm -rf /?
Resources
Among the first things I learned about Linux this is the one command that should never be entered. “Bad” things are supposed to happen.
Hypothesis
I believe that sudo rm -rf / will effectively and efficiently shred my file system and make the system unusable within a matter of seconds.
I am under this belief because it should remove nearly all of the files from the system…including the ones that make it work.
Experiment
I am going to open up a terminal and type sudo rm -rf /.
Data
A bunch of things happened, files were removed, and there were a lot of files that could not be removed. After the command was entered I did an ls expecting nothing to happen and all of the files in my working directory appeared to be there. To be honest I was surprised to find that the system didn't immediately crash.
Analysis
Based on the data collected:
- was your hypothesis correct?
No and yes. For some reason it appeared that the rm -rf / initially did nothing. This was incorrect as I couldn't even boot Ubuntu when I attempted after a restart.
- was your hypothesis not applicable?
It was applicable.
- is there more going on than you originally thought? (shortcomings in hypothesis)
If I were to guess there are probably fail safes built into Ubuntu that prevent the absolute nuking of the file system via this command. It may be possible however that the files that were removed were simply not on the surface. I probably should have taken the time to look through the file system in detail to find what was missing. Another “theory” I have is that everything was stored in some form of short term memory and therefore usable until I performed the reboot. (This is however just a theory I will get around to researching it at some point in time.)
- what shortcomings might there be in your experiment?
I don't think there are shortcomings in the experiment, I had root access and entered the command that should not be entered.
- what shortcomings might there be in your data?
I didn't look through the file system in detail after entering the command, doing so may have provided more insight as to what really happened.
Conclusions
I can say after this experiment that rm -rf should not be entered as it really will make your system unusable. I was looking for an explosive reaction of sorts and got firecrackers (for those people who appreciate metaphors) the firecrackers did end up burning down the house.
Retest
State Experiment
I am here today to bash on an experiment performed by Kelly Reed.(More or less prove him wrong because I think he can handle it.) http://lab46.corning-cc.edu/opus/fall2011/kreed11/start#experiment_1. The experiment performed was done in order to test the limit of the numeric value of a variable bash can handle.
Mo-Betta Experiment
So originally while retesting Kelly's experiment I did not use the command let. I simply entered a=1 a=11 etc. Doing it this way provided me far more places that bash can handle than 19 (I didn't exactly pay attention to his steps until after I tested it this way.) I got bored of entering a=1111111111111111111111111….etc and echoing it as I continued to get the return value. So to speed this process up I started to echo $a*$a | bc this also continued to give me an accurate return. (bc does however add in the /) After doing this I was thinking Kelly was crazy so I returned to his opus page to find out how he came to the conclusion that he did. Following his steps using let a=1234567890123456789 returned exactly the results he received. So my conclusion is that bash can handle more than 19 digits but let cannot. (I tried to man let and got nothing so I don't know at all what let's issue is, just that it has one)
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 am of the belief that bash is capable of far more than 19 digits. (I've seen it….I've seen a lot of things man)
Hypothesis
Kelly was of the opinion that bash would handle a number of places (32) or some value divisible by 2.
- Do you feel their hypothesis is adequate in capturing the essence of what they're trying to discover?
- Yes the conclusion was just wrong
- 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?
- No
- Would you make any alterations to the structure of the experiment to yield better results? What, and why?
- No
Data
Following the steps in Kelly's experiment I received exactly the same results.
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
- How about any sources of error?
- No
- Is the stated hypothesis adequate?
- Kind of
Conclusions
Answer the following:
- What conclusions can you make based on performing the experiment?
- Bash can handle more than 19 digits let for whatever reason is the problem
- Do you feel the experiment was adequate in obtaining a further understanding of a concept?
- Yes
- 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).
- Nope
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