User Tools

Site Tools


opus:spring2012:skinney1:unixpart1

unix Keywords

  1. Local host(done)
  2. Remote host(done)
  3. Home directory(done)
  4. Current working directory(done)
  5. Types of files (regular, directory, special)(done)
  6. File manipulation(done)
  7. Text Processing(done)
  8. The VI editor(done)

unix Keyword 1

Local Host

Definition

The local Host is standard host name referring to the reserved domain or address. It typically speaks to the name of the computer or larger web of networked computers that the user is on. For example the IPv4 address on the net work, 127.0.0.0

Demonstration

lab46:~/src/cprog/classproject$ /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 00:16:3e:5d:88:d8
          inet addr:10.80.2.38  Bcast:10.80.2.255  Mask:255.255.255.0
          inet6 addr: fe80::216:3eff:fe5d:88d8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:40022164 errors:0 dropped:0 overruns:0 frame:0
          TX packets:46989201 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7764390567 (7.2 GiB)  TX bytes:24326549986 (22.6 GiB)
          Interrupt:18

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:341910 errors:0 dropped:0 overruns:0 frame:0
          TX packets:341910 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:44926915 (42.8 MiB)  TX bytes:44926915 (42.8 MiB)

unix Keyword 2

Remote Host

Definition

A remote host is another computer at another location. It is typically a server on a private or public internet location. There are many ways to access a remote host. One way i use at work is the Remote Desktop Connection (run⇒ mstsc). From here you just need your host address of the computer in the network… and a valid login. This allows me to access the three workstations in my area and monitor their behavior from one desk. Another method is to use a SSH (secure Shell), such as Putty.

Demonstration

having a keygen file generated for your ssh connection

lab46:~$ sshe-keygen -t dsa
-bash: sshe-keygen: command not found
lab46:~$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/skinney1/.ssh/id_dsa): 1
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Passphrases do not match.  Try again.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in 1.
Your public key has been saved in 1.pub.
The key fingerprint is:
b9:73:c8:83:18:c8:57:a7:52:2a:d3:33:02:64:5d:06 skinney1@lab46
The key's randomart image is:
+--[ DSA 1024]----+
| o.Eoo           |
|o  ..            |
|.     o .        |
| o o + o .       |
|  * O . S        |
|   = * o o       |
|    . . * .      |
|         +       |
|                 |
+-----------------+

unix Keyword 3

Home Directory

Definition

A home directory is a system of files that is set up on a host for multi-user operating. It allows users to have their own home… or book shelf for their work and files.

Demonstration

On the Lab46 home directory there are many files set up each with read a write permission given only to the owner.

lab46:/home$ ls
ab000126   bwilson3  ds003420    jburlin1  jwood36   mpaul6      sclayton
abranne1   cacquah   dschoeff    jc006215  jzimmer5  mpresto4    sedward9
abrunda1   cas21     dshadeck    jcardina  kamakazi  mshort3     sjankows
acanfie1   caustin8  dsherbur    jcavalu3  kbell1    mtaft4      sjelliso
acarpen5   ccaccia   dshreve     jcosgro4  kboe      mwagner3    skinney1
acrocker   ccarpe10  dstorm3     jdavis34  kc017344  mwarne11    smacombe
adexter    cchandan  dtalvi      jdawson2  kcard2    mwitter3    smalik2
adilaur1   ccranda2  dtaylo15    jdrew     kcaton    nandre      smatusic
aettenb3   cderick   dtennent    jeisele   kcook6    nbaird      smclaug3
afassett   cdewert   dtravis4    jellis15  kcornel6  nblancha    smd15
agardin4   cforman   dwalrat1    jferrito  kdenson   ngraham2    smilfor3
ahazen     cgoodwin  dwells6     jfrail    kgarrah1  nrounds     spetka
ajernig2   ckelce    dwrigh18    jfurter2  kgaylord  nsano       spline
ajoensen   ckuehner  eberdani    jh001093  kinney    nsr1        squires
akundlas   clawren2  efarley     jhall40   kkrauss1  nvergaso    squirrel
alius      cmace1    egarner     jhammo13  klynch3   nwebb       srk3

unix Keyword 4

Current Working Directory

Definition

The current working directory is the directory of the hierarchical file system. Within you current working directory process and programs that are run default to using that space. Much like doing work at your desk. Anything you do goes onto your current workspace, unless effort is done to move the work to another area.

Demonstration

pwd lists your current working directory

lab46:~$ pwd
/home/skinney1

ls list the contents of your current working directory

lab46:~$ ls
*      Maildir   badname  cutcprog  lastexamp       public_html  temp
1      WELCOME   bin      devel     output          shell        yb452.zip
1.pub  YB452     count    file      phenny          src
123    archives  count.c  junk      phenny.tar.bz2  src.bak
lab46:~$

unix Keyword 5

Types of files (regular, directory, special)

Definition

In a Windows the OS knows from the tag at the end of the file what its' type is. It also know what program is required to use that file. UNIX is like this in many ways however it allows a little more freedom with the regular file type. Some sources stat that UNIX does not really have a specific file type. You can make a file extension what ever you want. In some cases you have a special file type like with gcc. Where you need a .out name of the file to be run correctly. for example, If we named all text files as .txt, then we would would be our standard file type. There are special types of files when you look as special devices, like gcc. The directory files types are really just lists of what is in the file. Like a log of accessible content.

Demonstration

Ls showing the file types in my junk drawer

lab46:~/junk$ ls -l
total 96
-rw-r--r-- 1 skinney1 lab46   128 Mar 14 12:15 dem1.c
-rwxr-xr-x 1 skinney1 lab46  6570 Mar 14 12:15 dem1.out
-rw-r--r-- 1 skinney1 lab46   699 Mar 14 12:44 dem2.c
-rwxr-xr-x 1 skinney1 lab46  7092 Mar 14 12:44 dem2.out
-rw-r--r-- 1 skinney1 lab46   553 Mar 14 22:49 dem3.c
-rwxr-xr-x 1 skinney1 lab46  6964 Mar 14 23:29 dem3.out
-rw-r--r-- 1 skinney1 lab46   259 Mar 14 23:30 dem4.c
-rwxr-xr-x 1 skinney1 lab46  6666 Mar 14 23:30 dem4.out
-rw-r--r-- 1 skinney1 lab46 11221 Mar 14 12:49 distributed in the hope that it will be useful,
-rw-r--r-- 1 skinney1 lab46 11221 Mar 14 12:49 file is part of the GNU C Library.
-rw-r--r-- 1 skinney1 lab46 11221 Mar 14 12:49 free software
-rw-r--r-- 1 skinney1 lab46 11221 Mar 14 12:49 seLeneral Public License for more details.

unix Keyword 6

File manipulation

Definition

File manipulation in Unix is just like with any other OS, they just have a few extra buttons to try out. For example the “tac” command has the ability to print the file in the reverse order, not sure why anyone would want to but nice to have the option. Another example is the “rev” command. This command prints every character in reverse order. The last example is the paste command. This will paste the contents of files that you want to merge to the screen. These are just fun examples but there are many more.

  1. fileExists – whether a file exists
  2. isRegularFile – whether a file is a regular file
  3. isDirectory – whether a file is a directory
  4. fileTime – get or set file modified time
  5. copyFile, see copyFile(String,String)
  6. moveFile, see moveFile(String,String)
  7. removeFile – remove a file
  8. findFiles – find files recursively
  9. symlinkFile – make a symbolic link to a file
  10. linkFile, see linkFile(String,String) – make a new link to a file
  11. readlink – readlink fn
  12. mkdir
  13. makeDirectory, see makeDirectory(String) – make a directory
  14. copyDirectory, see copyDirectory(String,String)
  15. removeDirectory – remove a directory
  16. symlinkDirectory, see symlinkDirectory(String,String) – make symbolic links for all files in a directory tree
  17. readDirectory – read the contents of a directory
  18. realpath – convert a filename to one passing through no symbolic links
  19. temporaryFileName – make a temporary file name

Demonstration

Tac command example

 lab46:~/junk$ tac dem1.c
}
  return (0);
  }
  printf("%d\n", x + y);
  {

  int y = 12;
  int x = 24;
{
int main()

#include<math.h>
#include<stdio.h>
lab46:~/junk$

rev command example

lab46:~/junk$ rev dem1.c
>h.oidts<edulcni#
>h.htam<edulcni#

)(niam tni
 {
;42 = x tni
;21 = y tni

{
;)y + x ,"n\d%"(ftnirp
}
;)0( nruter
}
lab46:~/junk$

Paste command example

lab46:~/junk$ paste dem1.c dem3.c dem2.c
#include<stdio.h>       #include <stdio.h>      #include <stdio.h>
#include<math.h>        #include <math.h>       #include <math.h>

int main()      int main()      int main()
{       {       {
  int x = 24;
  int y = 12;           int a = 2;              int a = 2 == 2;
                int b = 3;              int b = 2 != 3;
  {             int c = 4;              int c = 4 < 5;
  printf("%d\n", x + y);                int d = 5;              int d = 4 > 9;
  }                     int e = 3 >= 3;
  return (0);   //comparision operators         int x = 11;
}               printf("compare held values\n");                int y = 33;
                if (a != 0)     //basic math statements
                  {            printf("basic math expressions\n");
                   printf("the vaule is not equal to zero %d\n", a );          printf("%d\n", x - y);
                  }            printf("%d\n", x + y);
                if ((b > c) || (a > d))        printf("%d\n", x * y);
                  {            printf("%d\n", y / x);
                  printf("b and a are less then d. the values are %d %d\n ", b,a);             printf("%d\n", (x*y)/2);
                  }            printf("%d\n", ((y-x)/20)*100);
                if ((a && b && c) < 2)
                  {
                 printf("vaule for a, b and c are larger then 2\n");    //compare represetned vaule
                  }                     printf("compare held values\n");
                return 0;               printf("%d\n", a);
        }               printf("%d\n", b);
                        printf("%d\n", c);
                        printf("%d\n", d);
                        printf("%d\n", e);
                        return 0;
                }

lab46:~/junk$

unix Keyword 7

Text Processing

Definition

UNIX is a very powerful word processing tool that's history is being used in universities and development. The utilities are really and endless list that can help with doing everything you might needed done. Within class we use many of the commands like, cat to quickly present the contents of a file. Grep is another good example. This command can search a target file for a pattern and present the information.

Demonstration

Cat command example

lab46:~/junk$ cat dem1.c
#include<stdio.h>
#include<math.h>

int main()
{
  int x = 24;
  int y = 12;

  {
  printf("%d\n", x + y);
  }
  return (0);
}
lab46:~/junk$

Grep command example searching for the word main in the file called dem1.c.

lab46:~/junk$ grep 'main' dem1.c
int main()

unix Keyword 8

The VI editor

Definition

VI is a screen based text editor that has many tools for programmers. The popularity of the program is as old as linux and is shipped standard on most distributions. VI is noted to taking some time to get accustomed to it's features and benefits. Most people coming from the Microsoft style of text editing find the key based commands difficult at first. The program was written to be independent of a mouse, something that was not around when it was first developed. Thus the program has two modes, the command and insertion mode.

Demonstration

Screen shot of the opening

~
~                              VIM - Vi IMproved
~
~                               version 7.2.445
~                           by Bram Moolenaar et al.
~           Modified by pkg-vim-maintainers@lists.alioth.debian.org
~                 Vim is open source and freely distributable
~
~                        Become a registered Vim user!
~                type  :help register<Enter>   for information
~
~                type  :q<Enter>               to exit
~                type  :help<Enter>  or  <F1>  for on-line help
~                type  :help version7<Enter>   for version info

Working with a program

lab46:~$ view
#include<stdio.h>
intmain()
{




printf("vi is cool");
return(0)
}
:q!

unix Objective

Unix Objective

vs.

Definition

Explore the benefits and experience the two main GUIs' that are available for the Linux Desktop.

Method

Research and report the differences and benefits of both Desktops.

Install and use both Gnome and KDE. perform the following, then rate on a scale from 1 to 10 and report on issues or seen benefits.

  1. Connect to the internet
  2. Make a DVD play
  3. Make an .avi file play
  4. Install a game
  5. Use it for a few days as your normal computer

Measurement

Research _

1) Gnome

History

The official name is the “GNOME Project”. It was started in 1997 by Miguel se lcaza and Federico Mena. GNOME was started because at that time KDE was the for runner; however, it ran on proprietary software for its Qt widget toolkit. In 2000 the GNOME Foundation was established to facilitate administration tasks, supporter development and other not directly technical aspects. The community of supporters is no small amount. They hold a large conference every year called the GNOME Users and Developers European Conference (GUADEC). The community is made up of many supporters large and small. Some of the large name supporters are IBM, Sun Microsystems and Hewlett-Packard.

What is GNOME

Gnome is a user environment that is available for most Linux distributions. One aspect that defines GNOME is the window manager Mutter, formally Metacity. The name Mutter is short for Metacity Clutter. What Mutter does give the user a non traditional experience. The normal GUI has a tool bar and the main Desktop is the area of business. Mutter is utilized within the what GNOME calls the Unity Desktop Environment. Now the Desktop is a clean slate and by calling up Mutter you have access to multiple work areas, programs and everything else that is on the traditional desktop.

Current release is 3.4.

Developments

The step into the Unity Desktop environment is a step towards the old Linux philosophy of many different areas that work well together. This has spread across tablets and phones. Unity is trying to position itself as a core environment for all platforms, must like Google has done with the Droid OS.

Distributions

Most if not all come packages with GNOME as Default or and option.

Opinion

While Unity is a step forward it leaves me feeling like i have lost control. Many people have written in complaints about the new Mutter world. I guess it just comes down to the way i like to use my desktop as a work surface. I was actually hoping that the future would bring the ability to customize each desktop more… not less. The new way that the desktops are called up actually makes them almost useless. They come when you call up the activities panel and are just a picture for the most part. Even calling a different program on each tend to merge the programs to the first desktop. Again, i want 4 virtual machines on a cube… that is the most impressive and use full desktop i have ever had. I feel like somewhere we took a wrong turn. There is nothing like the good old ctrl+alt arrow. Making you step away from the cube desktop (thanks compiz) and just watching your friends amazement as you shatter the Windows one desktop world.

GNOME Environment

2) KDE

History

KDE (K Desktop Environment) was started before GNOME in 1996 by Matthais Ettrich. The goal of KDE was to functional work the same and be a cross plateform desktop and applications,(FreeBSD, linux, windows, Solaris and Mac OSX). KDE has a large development base and many supporters.

What is KDE?

KDE has the look and feel of most GUIs out there for linux. It does work differently in some basic ways. However, it is easy to find how to navigate around differences. The look and feel comes from kwin being the main functional part of the Desktop. Giving you control over the environment.

Current release KDE 4.6

Developments

KDE had a major problem on their hands when they released KDE 4. The user interface was drastically changes, much like GNOME 3. The KDE community rose up and many changes happened.

Opinion

KDE 4.6 feels more like home then GNOME 3. You are able to use the desktops and customize them in many ways. However, you are still limited in these virtual workspaces as to what you can do. They are more of an idea of a virtual workspace but they are not workspaces. You cannot add icons to one without it being on them all etc. I have always wanted to have one for fun, one for college…etc. I had a hard time installing packets needs and found it confusing to navigate. Something the KDE founding mission has failed in as they want it to have an ease of use.

GUI Environment

Conclusion

Sources

Experience

GNOME

  1. Connect to the internet

10: Ease of use. Simple right click opened many connections that even windows does not find. Able to quickly add my key and it connects without a problem. Nivigates communication with my router much faster then I have experienced with Windows. I also have an issue where my Win Machine drops the routers information and the router has to be restarted so they can be friends again. A problem i did not see at all. Even when downloading Gbs over the net.

  1. Make a DVD and .avi play

7: I fully understand that proprietary driver packs are against the GUL and Opensource licenses. These used to be a beast to get and install but could done from the command line with sudo apt-get libdvdcss4 etc. All went well you were off an running but the learning curve took some time. The community documentation was dumbed down enough for anyone to use. In the new GNOME 3 world you still have the same issue; however, they have made it simple. When you try to play a file that requires prop drivers you get this nice little prompt. It asks you if you are sure you want to use prop drivers and away it goes. Installs after asking for your root pass life is off and running. Want to make it better? Ask me when i install it in the first place and install all of them. i like to know how to do something but after that.. i just want it done.

  1. Install a game

7: Well I cannot say much. They have added something very much like the google play market. Easy to install, nice icons… really trying to pit developers to better the choices. Pay for apps are starting to creep in. As for the quality of what is there… mostly the same boring junk. Free is nice, but i want to be able to play good stuff. Wine has made major improvements and this helps. So starcraft was installed and off i went.

  1. Use it for a few days as your normal computer

6: I have been a GNOME user for along time.. 5 years, maybe more. My flavor was Ubuntu, even have a sweater. I just cannot get Unity. I feel like i was taken from a college level and put in highschool again. I want more control over my linux GUI… that is why i love linux. The next area would be functionality. I do still have a win machine just because it is a windows world and Chrome is nice. I found Chrome for Gnome and was happy with that.

Total Score: 30

KDE

  1. Connect to the internet

9: Connected without any problems. Did not see as many local connections but mine is the only one that is important. Did have issues with reconnecting after going to sleep.

  1. Make a DVD and .avi play

4: I gave up. The repositories have to be added and then you can access the different drivers. There is not one clear repository that holds the drivers and not knowing that they have to be added send to in circles. The same prompt to install comes up when running the media however it just comes up with an unhelpful error code. After a few days of playing with this i installed another media player and found it worked fine. Totem is just different on KDE. I installed SUSI on another machine and was not able to get the driver pack working like i did on the first machine.

  1. Install a game

5: You have a list of names, nothing shinny and for KDE that is an issue. As they are on a mission to be sleek. They have a classic list of packets unlike the store approach of GNOME. So you have to know what you are after. WINE did not install with the ability to have starcraft run easily. That was a beast and when i did get it running.. games play was highly taxed.

  1. Use it for a few days as your normal computer

6: Without my movies or any real entertainment I was left to just searching the web. Found i did not have Chrome… Firefox is nice but has lost competitiveness with Chrome. I just did not have much to use it for. Total Score: 24

Analysis

I came in with KDE rating just 6 points lower then GNOME. KDE was such a heart break and held so many restrictions to fun that I just have to sadly turn to Unity. Thankfully you can add and use the traditional desktop still with GNOME 3. For this little adventure i learned a lot about the purpose and direction of the two main GUIs of the linux world.

opus/spring2012/skinney1/unixpart1.txt · Last modified: 2012/04/15 12:39 by skinney1