User Tools

Site Tools


opus:fall2011:kreed11:part1

Part 1

Entries

Month Day, Year

This is a sample format for a dated entry. Please substitute the actual date for “Month Day, Year”, and duplicate the level 4 heading to make additional entries.

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?
  • Why was this significant?
  • What concepts are you dealing with that may not make perfect sense?
  • What challenges are you facing with respect to the course?

Remember that 4 is just the minimum number of entries. Feel free to have more.

Topics

Home Directory

Represented by ~ this is your default working directory. This can be changed by using the usermod command as such: “usermod -d /path/to/new/homedir/ username”. you can navigate directly to your home directory from any where on the system by issuing the CD command with no arguments. ~/ can also be used as short hand when giving an absolute location.

line 1 is an example of a home directory, it is represented by ~ even though the actual location on the system looks more like line 2

lab46:~$ pwd
/home/kreed11

using cd to move to home.

lab46:/etc/vim$ cd
lab46:~$ pwd
/home/kreed11

changing the home dir.

lab46:~$ pwd
/home/kreed11
lab46:~$ usermod -d /home/kreed11/bin kreed11
lab46:~$ pwd
/home/kreed11/bin

using ~ as an absolute location

lab46:/$ mv test ~/file/test
lab46:/$ cd ~/file
lab46:~/file$ ls
test
lab46:~/file$ pwd
/home/kreed11/test

Current Working Directory

The directory you happen to be in. typically shown by the prompt. absolute path can be found by issuing pwd command.

prompt shows the current working directory to be /bin.

lab46:/bin$

absolute current working directory shown by pwd

lab46:~$ pwd
/home/kreed11

Types of Files: Directories

Files that contain files. Can be created by the mkdir command and deleted by the rmdir and rm commands.

directories are donated by the “d” in the attributes field.

lab46:~$ ls -l
total 12
drwxr-xr-x 3 kreed11 lab46   95 Sep 27 15:11 Downloads
lrwxrwxrwx 1 kreed11 lab46   17 Aug 19  2010 Maildir -> /var/mail/kreed11
drwx------ 3 kreed11 lab46  142 Sep 29 15:21 bin
drwx------ 2 kreed11 lab46   42 Sep 22 15:18 closet
drwxr-x--x 2 kreed11 lab46   34 Sep 27 15:17 dl
drwx------ 4 kreed11 lab46   39 Sep 29 14:50 irc
-rw------- 1 kreed11 lab46  121 Sep  8 15:17 nohup.out
drwx---r-x 3 kreed11 lab46   16 Sep  1 15:27 public_html
drwx------ 2 kreed11 lab46    6 Sep  1 14:43 src
-rw------- 1 kreed11 lab46    0 Apr 11  2008 times
drwx------ 2 kreed11 lab46 4096 Sep 22 16:41 tmp
-rw-r--r-- 1 kreed11 lab46 1659 Sep 27 15:00 wget-log
lab46:~$ cd Downloads
lab46:~/Downloads$ ls -l
total 16132
drwx------ 4 kreed11 lab46       28 Aug 28 17:24 FileZilla3
-rw-r--r-- 1 kreed11 lab46  4828020 Sep  1 15:36 FileZilla_3.5.1_x86_64-linux-gnu.tar.bz2
-rw-r--r-- 1 kreed11 lab46 11689917 Sep  1 15:39 WinRARLinux.tar.gz
lab46:~/Downloads$

creating and deleting a directory

lab46:~$ ls -l
total 12
drwxr-xr-x 3 kreed11 lab46   95 Sep 27 15:11 Downloads
lrwxrwxrwx 1 kreed11 lab46   17 Aug 19  2010 Maildir -> /var/mail/kreed11
drwx------ 3 kreed11 lab46  142 Sep 29 15:21 bin
drwx------ 2 kreed11 lab46   42 Sep 22 15:18 closet
drwxr-x--x 2 kreed11 lab46   34 Sep 27 15:17 dl
drwx------ 4 kreed11 lab46   39 Sep 29 14:50 irc
-rw------- 1 kreed11 lab46  121 Sep  8 15:17 nohup.out
drwx---r-x 3 kreed11 lab46   16 Sep  1 15:27 public_html
drwx------ 2 kreed11 lab46    6 Sep  1 14:43 src
-rw------- 1 kreed11 lab46    0 Apr 11  2008 times
drwx------ 2 kreed11 lab46 4096 Sep 22 16:41 tmp
-rw-r--r-- 1 kreed11 lab46 1659 Sep 27 15:00 wget-log
lab46:~$ rm -rf tmp
lab46:~$ ls -l
total 8
drwxr-xr-x 3 kreed11 lab46   95 Sep 27 15:11 Downloads
lrwxrwxrwx 1 kreed11 lab46   17 Aug 19  2010 Maildir -> /var/mail/kreed11
drwx------ 3 kreed11 lab46  142 Sep 29 15:21 bin
drwx------ 2 kreed11 lab46   42 Sep 22 15:18 closet
drwxr-x--x 2 kreed11 lab46   34 Sep 27 15:17 dl
drwx------ 4 kreed11 lab46   39 Sep 29 14:50 irc
-rw------- 1 kreed11 lab46  121 Sep  8 15:17 nohup.out
drwx---r-x 3 kreed11 lab46   16 Sep  1 15:27 public_html
drwx------ 2 kreed11 lab46    6 Sep  1 14:43 src
-rw------- 1 kreed11 lab46    0 Apr 11  2008 times
-rw-r--r-- 1 kreed11 lab46 1659 Sep 27 15:00 wget-log
lab46:~$ mkdir tmp
lab46:~$ ls -l
total 8
drwxr-xr-x 3 kreed11 lab46   95 Sep 27 15:11 Downloads
lrwxrwxrwx 1 kreed11 lab46   17 Aug 19  2010 Maildir -> /var/mail/kreed11
drwx------ 3 kreed11 lab46  142 Sep 29 15:21 bin
drwx------ 2 kreed11 lab46   42 Sep 22 15:18 closet
drwxr-x--x 2 kreed11 lab46   34 Sep 27 15:17 dl
drwx------ 4 kreed11 lab46   39 Sep 29 14:50 irc
-rw------- 1 kreed11 lab46  121 Sep  8 15:17 nohup.out
drwx---r-x 3 kreed11 lab46   16 Sep  1 15:27 public_html
drwx------ 2 kreed11 lab46    6 Sep  1 14:43 src
-rw------- 1 kreed11 lab46    0 Apr 11  2008 times
drwx------ 2 kreed11 lab46    6 Sep 30 11:04 tmp
-rw-r--r-- 1 kreed11 lab46 1659 Sep 27 15:00 wget-log
lab46:~$

Files: Listing

To list the files in your current directory, issue the ls command

lab46:~$ ls
Downloads  bin     dl   nohup.out    src    tmp
Maildir    closet  irc  public_html  times  wget-log
lab46:~$

Files: Copying

To copy a file use the cp command

lab46:~/tmp$ ls
folder  test
lab46:~/tmp$ cp test folder/test
lab46:~/tmp$ ls
folder  test
lab46:~/tmp$ cd folder/
lab46:~/tmp/folder$ ls
test
lab46:~/tmp/folder$ 

Files: Moving / Renaming

Moving and renaming files is accomplished with the mv command

lab46:~/tmp$ ls
folder  test
lab46:~/tmp$ mv test folder/test
lab46:~/tmp$ ls
folder
lab46:~/tmp$ cd folder
lab46:~/tmp/folder$ ls
test
lab46:~/tmp/folder$ mv test ~/tmp/testrename
lab46:~/tmp/folder$ ls
lab46:~/tmp/folder$ cd..
lab46:~/tmp$ ls
folder  testrename
lab46:~/tmp$

Files: Removing

To remove or delete files use the rm command

lab46:~/tmp$ ls -l
total 0
drwx------ 2 kreed11 lab46 6 Sep 30 11:14 folder
-rw------- 1 kreed11 lab46 0 Sep 30 11:10 testrename
lab46:~/tmp$ rm testrename
rm: remove regular empty file `testrename'? y
lab46:~/tmp$ ls -l
total 0
drwx------ 2 kreed11 lab46 6 Sep 30 11:14 folder
lab46:~/tmp$

Files: Creating

The creation of files can be accomplished by the touch and mkdir commadns and alternativly by saving a file from within a program such as nano

creating with commands:

lab46:~/tmp$ ls
folder
lab46:~/tmp$ touch test
lab46:~/tmp$ ls
folder  test
lab46:~/tmp$ mkdir folder2
lab46:~/tmp$ ls -l
total 0
drwx------ 2 kreed11 lab46 6 Sep 30 11:14 folder
drwx------ 2 kreed11 lab46 6 Sep 30 11:21 folder2
-rw------- 1 kreed11 lab46 0 Sep 30 11:20 test
lab46:~/tmp$

Files: Compressing / Decompressing

Compression and Decompression is most commonly accomplished with the tar command.

lab46:~/tmp$ ls
test  test2
lab46:~/tmp$ tar -cvf compressed.tar test test2
test
test2
lab46:~/tmp$ ls -l
total 12
-rw------- 1 kreed11 lab46 10240 Sep 30 11:28 compressed.tar
-rw------- 1 kreed11 lab46     0 Sep 30 11:20 test
-rw------- 1 kreed11 lab46     0 Sep 30 11:28 test2
lab46:~/tmp$ rm -rf test
lab46:~/tmp$ rm -rf test2
lab46:~/tmp$ ls -l
total 12
-rw------- 1 kreed11 lab46 10240 Sep 30 11:28 compressed.tar
lab46:~/tmp$ tar -xvf compressed.tar
test
test2
lab46:~/tmp$ ls -l
total 12
-rw------- 1 kreed11 lab46 10240 Sep 30 11:28 compressed.tar
-rw------- 1 kreed11 lab46     0 Sep 30 11:20 test
-rw------- 1 kreed11 lab46     0 Sep 30 11:28 test2
lab46:~/tmp$

File: Permissions

File permissions are useful for allowing or disallowing other users access to files. chmod is the command used for modifying permissions. File permissions can be viewed by reading the attributes column after issuing an ls -l command. the attributes section is 10 digits long, the first donates file type, the next three are owner permissions, the following three are group permissions and the last is everyone else permissions. each group of three is broken down in to read write and execute donated by a R, W, or X. each of the three groups can have R, W or X permissions seperate form the other so that if the last three is R– and the second is — then some one from the system can not see the file but the rest of the world can while neither can write or execute.

lab46:~/tmp$ ls -l
total 0
-rw------- 1 kreed11 lab46 0 Sep 30 11:20 test
-rw------- 1 kreed11 lab46 0 Sep 30 11:28 test2
lab46:~/tmp$ chmod 666 test
lab46:~/tmp$ ls -l
total 0
-rw-rw-rw- 1 kreed11 lab46 0 Sep 30 11:20 test
-rw------- 1 kreed11 lab46 0 Sep 30 11:28 test2
lab46:~/tmp$

Tab Completion

Tab completion allows the user to finish typing uniqe commands, directories and pritymuch any thing with out actually typing the entire word, command, etc. This accomplished by typing enough letters to find an unique match on the system then pressing TAB to fill in the rest.

lab46:~/tmp$ ls -l
total 0
-rw-rw-rw- 1 kreed11 lab46 0 Sep 30 11:20 test
-rw------- 1 kreed11 lab46 0 Sep 30 11:28 test2
-rw------- 1 kreed11 lab46 0 Sep 30 15:05 wikipedia
lab46:~/tmp$ cat wi

press TAB

lab46:~/tmp$ cat wikipedia
wikipedia test document
lab46:~/tmp$

Back-grounding a Process

to Back-ground a process that is already running you will need to issue it a Ctrl-Z to suspend the process. Then the BG command to reanimate and run in the background. When executing a program or script, the & can be added to the end to set the process to run in the background from the start.

lab46:~/tmp$ cat

issue Ctrl-Z

^Z
[1]+  Stopped                 cat
lab46:~/tmp$ bg
[1]+ cat &
lab46:~/tmp$ ps
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
kreed11  12068  0.0  0.1  13664  2000 pts/59   SNs  Sep22   0:00 /bin/bash
kreed11  12072  0.0  0.5  42532  5368 pts/59   SN+  Sep22   1:06 irssi
kreed11  25847  0.0  0.1  13648  2048 pts/51   SNs  14:43   0:00 -bash
kreed11  30182  0.0  0.0   5860   532 pts/51   TN   15:14   0:00 cat
kreed11  30223  0.0  0.0   8584   968 pts/51   RN+  15:15   0:00 ps u
lab46:~/tmp$

starting in the background with &

lab46:~/tmp$ cat &
[1] 30859
lab46:~/tmp$ ps
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
kreed11  12068  0.0  0.1  13664  2000 pts/59   SNs  Sep22   0:00 /bin/bash
kreed11  12072  0.0  0.5  42532  5368 pts/59   SN+  Sep22   1:06 irssi
kreed11  25847  0.0  0.1  13648  2056 pts/51   SNs  14:43   0:00 -bash
kreed11  30646  0.0  0.0   5860   528 pts/51   TN   15:17   0:00 cat
kreed11  30694  0.0  0.0   8584   972 pts/51   RN+  15:18   0:00 ps u
lab46:~/tmp$

Objectives

Objective 1

State the course objective; define what that objective entails.

Method

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

Measurement

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

Analysis

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

  • How did you do?
  • Room for improvement?
  • Could the measurement process be enhanced to be more effective?
  • Do you think this enhancement would be efficient to employ?
  • Could the course objective be altered to be more applicable? How would you alter it?

Experiments

Experiment 1

Question

What is the limit of a numeric variable in bash?

Resources

Hypothesis

Since bash is x86 based I would assume that the limit will be in the range of 32 bits or at least a power of 2.

Experiment

set a value to 1 and increase the number of places it contains (12, 123, 1234, etc) intill bash does not return what was set.

Data

lab46:~/tmp$ let a=1
lab46:~/tmp$ echo a
a
lab46:~/tmp$ echo $a
1
lab46:~/tmp$ let a=1234567890123456789
lab46:~/tmp$ echo $a
1234567890123456789
lab46:~/tmp$ let a=12345678901234567890
lab46:~/tmp$ echo $a
-6101065172474983726
lab46:~/tmp$

Analysis

Based on the data collected:

  • was your hypothesis correct? no
  • was your hypothesis not applicable? not sure
  • is there more going on than you originally thought? (shortcomings in hypothesis) mabe
  • what shortcomings might there be in your experiment?
  • what shortcomings might there be in your data?

Conclusions

bash can only handle numbers up to 19 digits, why i have no idea…

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.

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

opus/fall2011/kreed11/part1.txt · Last modified: 2011/10/23 16:23 by wedge