User Tools

Site Tools


opus:fall2012:dsherbur:part2

Part 2

Entries

Entry 1: October Day, 2012

LETS PLAY WITH PS1!!

There are several PS lines to work with, and right now, we are going to play with the PS1 line. PS1 is an environment variable and is determines what your prompt looks like. Maybe you'd like your prompt to show the absolute path that you are standing in. Maybe you'd like to play your ego and have your prompt beg for a command (kinky). There are many ways to customize your prompt, especially when you start working with the other PS lines. You can even change your color scheme!

lab46:~$ echo $PS1
\h:\w\$
lab46:~$ PS1="victory@\h:\w\$"
victory@lab46:~$PS1="\u@\h:\w\$"
dsherbur@lab46:~$PS1="\u@\h:\W\$"
dsherbur@lab46:~$PS1="\s\\\T\j\#\\\$""
> ^C
dsherbur@lab46:~$PS1="\s\\\T\j\#\\\$"
-bash\T06$whoami
dsherbur
-bash\T07$PS1="\s;\T;\j\#"job"\\\$"
-bash;12:21:10;08job$PS1="\s;\T;\j\#"job"\\\$  "
-bash;12:21:26;09job$

Dates, hosts, jobs, command numbers, and thats just PS1! Working outside of lab46, like, say, on Ubuntu, you can get programs like Bashish and really change the look of your terminal. However, changing the PS1 line in lab46 is only temporary and will revert to a default state when you log out and log back in.

Entry 2: October Day, 2012

LETS GET A JOB!!

So. we've learned a lot about using a unix/linux system, but where does that get us? Well, one route to go with this new-found knowledge is becoming a UNIX/Linux administrator. Junior admins can expect to make about 55k/year while senior admins can expect closer to 90k and up. Not too shabby. These positions can require a bachelor's degree and several years of experience in a related field such as IT. Job growth and compensation is set to increase over the next several years, thereby growing demand for technically inclined folks with a solid linux background. Careers in technology in general are set to grow in the future anyway, so this isn't much of a surprise.

Entry 3: October Day, 2012

FONT CHANGE (MAYBE)! I MISS ARIAL!!

After playing with the PS1 line for a bit, I realized how much I enjoy working with linux on my home computer. I looks a lot better, what with the color and screen resolution and all. So I wonder if I can change the font on lab46. This would be a good experiment.

Entry 4: October Day, 2012

UNIX IN GERMAN? LOLWTF!

In addition to UNIX Fundamentals and Calculus 3, I am also taking German 1. I think I'd like to live in Germany one day, hopefully before another republican gets elected president. To successfully expatriate myself, I need to be proficient in the native tongue of the country I am seeking to live in. I also need a set of skills that would get myself a job so I'm not homeless and stuck in a foreign country. So, my question is, is there a German language version of unix, more specifically bash? I know that German and English are pretty similar, and there have to be computer-related jobs in Germany as well as the rest of the developed world. Do they have a different set of commands that make sense to a German-speaking programmer? Regular expressions would stay mostly the same, but what about commands like cd and ls and cat? On article I read said that even though Linus Torvalds was from Sweden and learned English as a second language, he preferred using it when talking about computer stuff to his comrades, even if they spoke English as a second language. There is some talk about English having a more extensive technical vocabulary, and that if programming languages like C and bash each had a different version to agree with a certain natural language, it would be a massive project and it most likely would never be finished. So, I guess being a natural English speaker is going to make me a wizard in Germany someday.

Keywords

Keyword 2 Phase 1

alias

Definition

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

Alias: semantics applied to the command shell. An alias is a string substituted for another string. If, for example, you always need to use the -l option to ls, you would be typing ls -l and potentially wasting 3 keystrokes. With the help of alias, we can make a more terse command that accomplishes what you want without typing more than is absolutely necessary.

lab46:~$ alias lsl='ls -l'
lab46:~$ lsl
total 72

Alias can also take pipes, which means you can write very lengthy incantations, and instead of typing the whole thing out or trolling through your history to use it again, you can make an alias and make your life a touch easier.

lab46:~$ alias lsl='ls -l | wc -l'
lab46:~$ lsl
30

Aliasing can be used to customize your commands, as well as to play some cruel pranks. If someone walks away from an open terminal, you could alias one command to something completely different, like alias vim='cd /; cat *', or alias cd='cat /dev/random'.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

Keyword 2 Phase 2: I/O Redirection

Definition

There is no clear definition for I/O redirection but both of these in the UNIX universe in particular are actually two components of our interface that we use at every given moment while actively using the terminal or even this browser. The Input is coming from your computer's keyboard or terminal keyboard while the Output is what you see on the monitor typically, such as in the Lab46 Terminal, the text you see is the output. In the middle of both input and output is actually where all the processing happens, this is key to the redirection as it has an effect to where the output will be directed. There are two kinds of I/O redirection, them being represented by the less than and greater than symbols ><. The less than < symbol is what does input redirection, commonly useful for when a program doesn't read files but reads from standard input, for example, you can have file1 send its contents to a mail of some sort like jackrabbit@rabies.org and the command would look something like this: mail jackrabbit@rabies.org < file1

The greater than > symbol does the “opposite” and is used in a different scenario. Say you wanted all the output you receive from issueing an ls -l command to be put into file2. Just do ls > file2 and all that output will be within the file.

Some other important concepts about I/O redirection is usage of the pipe | and the semicolon ;. The pipe and semi are used when you want to use more than one command at one time, but the difference between the two is crucial to a successful incantation. The pipe will redirect output from the initial command into the next command while the semicolon will not redirect any output into the next command, it will just perform it as if you were doing it singularly. A situation where the semicolon is crucial is if you have a cat command following your initial casting.

Now when you use the output redirect, one thing to keep in mind is that if you send another piece of output into file2 with a single >, it will overwrite the file with that new output and the old output from ls -l will no longer be there.

References

  • O'Reilly Learning The UNIX Operating System

Demonstration

Demonstration of the indicated 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);
}

Alternatively (or additionally), 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$ 

In my first experiment, I tried to make an incantation that combs the entire filesystem for a search parameter. Its kind of primitive, and most of the output is error text. We can redirect that error text to clean that up a bit (wedge).

Experiment 2

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

opus/fall2012/dsherbur/part2.txt · Last modified: 2012/12/06 12:59 by dsherbur