Today is the start of the best class of the semester. We began to study basic Unix commands and began to discover the magic behind the commands. We learned some pretty useful commands:
ls - this allowed us to see all the files inside of a directory who - shows who is logged onto the lab 46 terminal screen -r - this allows us to reconnect to our class chat ctr -a tapD - this allows us to leave our chat without closing it.
Right now the whole Unix setting doesn't make any sense but soon I hope to have a better understanding of it. The challenges I may face are basically keeping track of my time and remembering commands.
Today we played with a new web browser and worked on our opus and first project “ Filesystem Safari”. We got a lot of help with our opus and I am finally able to start editing due to the fact that I had no idea how to edit one. At this point in time my biggest challenge will be keeping up with my opus and coming up with projects. I have really bad time management and need to start doing better with these areas.
We learned today how to script using for-loops. We learned a few commands today.
cut - which allows the removal -d'' - this is the delimiter. within the single quotes you place the delimiter which is the - seperater withing what your looking at. - ex filename.extension -d'.' makes it so that the delimiter is the "." --output-delimiter="..." - this changes the delimiter so that if needed you - can change it to coincide with other O.S.
we also learned about fields. A field is the part that you are looking at. When combined with a delimiter you can select certain field designated by the delimiter.
these three things in combination within a script allow for the echo of something cut out by selecting the field designated by a delimiter.
For now luckily I am understanding everything but my biggest challange with this course is time management.
Today we learned about ii which is also called irc improved. Using this we are able to create a bot.
We also spent a small amount of time playing with a very old Toshiba Satellite that ran on ms-dos and Windows 3.11; unfortunately it was broken at first but we fixed it by dropping it.
We explored bot programming and learned how to give our bots commands and have it take action on those commands.
One funny thing that happened was Wedges bot William thought we were flooding the irc chat when we tried to all activate our bots and it banned us all. even our teacher got banned thus proving we may have invented sky-net.
One concept that is eluding me is that a bot can be random like Wezlbot but has to be programmed to respond and I wish to learn how to make it random. <(^^,)>
The local host is the person or main page of whats running. If it is a website the local host will take you to the main page. In the lab 46 terminal we work on there are many users but the local host is the lab 46 terminal because it is hosting us as the users.
A remote host is something that allows the access of files or data from a distant location. Say you have a server with all your info and you go to access it from your home computer and retrieve the data. the server is the local host.
The home directory is the main start up of a UNIX terminal. It is where you start once you log on. This is usually your directory that you can edit yourself and change restrictions of the material to others.
lab46:~$ pwd /home/cforman lab46:~$ whoami cforman lab46:~$
This shows where I am … that is the home directory within my section. cforman means i can edit there making me the owner of that directory.
The working directory is the space that you are in. IT has a hierarchy system to it. there is one main directory and multiple directories within it. The directory you are in is the working directory. This can be seen using the pwd command.
lab46:~$ pwd /home/cforman
In Linux everything is a file. There are three types of files.
The first type is regular. This is the normal files that you edit with text. they can be edited using nano or vi.
The second type of file is a directory. This is more like a folder in Windows. You can store regular files and special files within the directory file. You can enter the directory file by using the command “cd 'directoryname'” Directories are colored blue on the terminal.
lab46:~$ cd tmp lab46:~/tmp$ ls file haha hola killyou mwajajaja testsubject lab46:~/tmp$
tmp is a directory and there are files within it.
Special files are the third type of file. This file is not text nor is it a directory. this is an executable files usually. It allows interaction with the hardware of the computer to complete a certain function. A text file can be turned into a special file by using the command, “ chmod u+x filename”
Simply what it says. listing files is using a command to display the files in a directory. the command ls or ls -l are the most used listing commands.
lab46:~$ ls Maildir cake irc public_html src tmp bin closet motd shellscripting src.orig vitest lab46:~$ ls -l total 12 lrwxrwxrwx 1 cforman lab46 17 Aug 28 10:37 Maildir -> /var/mail/cforman drwxr-xr-x 2 cforman lab46 124 Sep 29 16:49 bin -rw-r--r-- 1 cforman lab46 3 Sep 6 16:21 cake drwxr-xr-x 2 cforman lab46 69 Sep 15 16:11 closet drwx------ 4 cforman lab46 39 Sep 29 14:55 irc -rw-r--r-- 1 cforman lab46 1310 Sep 15 15:13 motd drwx-----x 2 cforman lab46 6 Aug 26 2009 public_html drwxr-xr-x 2 cforman lab46 6 Sep 22 15:21 shellscripting drwx------ 2 cforman lab46 6 Sep 6 14:31 src drwx------ 4 cforman lab46 45 Sep 4 21:29 src.orig drwxr-xr-x 2 cforman lab46 97 Sep 30 23:06 tmp -rw-r--r-- 1 cforman lab46 23 Sep 15 14:54 vitest lab46:~$ ls is a basic listing of the files in a directory. ls -l shows the permisions, owner, size, last edited time, name of the files.
There are many ways to copy a file. you can “echo $filename | 'other file'”, you can “cat 'filename' | 'anotherfilename'” or you can just “cp 'filename' 'newfile'” all three ways work.
This is easily done using the rm command a variation of rm “rmdir” allows for not just the removal of a file but a whole directory.
lab46:~$ ls Maildir cake data motd shellscripting src.orig vitest bin closet irc public_html src tmp lab46:~$ touch testfiel lab46:~$ ls Maildir cake data motd shellscripting src.orig tmp bin closet irc public_html src testfiel vitest lab46:~$ mkdir testdirectory lab46:~$ ls Maildir closet motd src testfiel bin data public_html src.orig tmp cake irc shellscripting testdirectory vitest lab46:~$ rm testfiel rm: remove regular empty file `testfiel'? y lab46:~$ rmdir testdirectory lab46:~$ ls Maildir cake data motd shellscripting src.orig vitest bin closet irc public_html src tmp lab46:~$
As seen above the commands mkdir makes directories and the command touch creates files. Files also can be created by opening the VI and saving the data inputted with a name and VI will create the file within the directory you were.
Ownership of a file is shown when the command ls -l is used.
lab46:~$ ls -l total 16 lrwxrwxrwx 1 cforman lab46 17 Aug 28 10:37 Maildir -> /var/mail/cforman drwxr-xr-x 2 cforman lab46 4096 Oct 6 16:22 bin -rw-r--r-- 1 cforman lab46 3 Sep 6 16:21 cake drwxr-xr-x 2 cforman lab46 69 Sep 15 16:11 closet lrwxrwxrwx 1 cforman lab46 27 Oct 4 14:36 data -> /usr/local/etc/data/cforman drwx------ 4 cforman lab46 39 Sep 29 14:55 irc -rw-r--r-- 1 cforman lab46 1310 Sep 15 15:13 motd drwx-----x 2 cforman lab46 6 Aug 26 2009 public_html drwxr-xr-x 2 cforman lab46 6 Sep 22 15:21 shellscripting drwx------ 2 cforman lab46 6 Sep 6 14:31 src drwx------ 4 cforman lab46 45 Sep 4 21:29 src.orig drwxr-xr-x 2 cforman lab46 97 Sep 30 23:06 tmp -rw-r--r-- 1 cforman lab46 23 Sep 15 14:54 vitest lab46:~$
The name of the user who created the file will show up in the line produced by the ls -l command.
I would like to test my ability to use and understand information displayed by the ls and ls -l commands.
I will enter the lab46 terminal and test my ability to see the files and then use the -l extension to elaborate on the information given by the ls command.
lab46:~$ ls -l total 16 lrwxrwxrwx 1 cforman lab46 17 Aug 28 10:37 Maildir -> /var/mail/cforman drwxr-xr-x 2 cforman lab46 4096 Oct 6 16:22 bin -rw-r--r-- 1 cforman lab46 3 Sep 6 16:21 cake drwxr-xr-x 2 cforman lab46 69 Sep 15 16:11 closet lrwxrwxrwx 1 cforman lab46 27 Oct 4 14:36 data -> /usr/local/etc/data/cforman drwx------ 4 cforman lab46 39 Sep 29 14:55 irc -rw-r--r-- 1 cforman lab46 1310 Sep 15 15:13 motd drwx-----x 2 cforman lab46 6 Aug 26 2009 public_html drwxr-xr-x 2 cforman lab46 6 Sep 22 15:21 shellscripting drwx------ 2 cforman lab46 6 Sep 6 14:31 src drwx------ 4 cforman lab46 45 Sep 4 21:29 src.orig drwxr-xr-x 2 cforman lab46 97 Sep 30 23:06 tmp -rw-r--r-- 1 cforman lab46 23 Sep 15 14:54 vitest lab46:/$ ls bin etc lib lost+found opt sbin sys var boot home lib32 media proc selinux tmp vmlinuz dev initrd.img lib64 mnt root srv usr lab46:/$ ls -l total 118 drwxr-xr-x 2 root root 4096 Sep 20 15:12 bin drwxr-xr-x 2 root root 4096 Oct 10 21:13 boot drwxr-xr-x 13 root root 2540 Oct 10 21:14 dev drwxr-xr-x 102 root root 12288 Oct 11 19:13 etc drwxr-sr-t 354 root staff 12288 Sep 20 11:05 home lrwxrwxrwx 1 root root 34 Jun 14 2010 initrd.img -> boot/initrd.img-2.6.32-5-xen-amd64 drwxr-xr-x 10 root root 12288 Aug 28 10:14 lib drwxr-xr-x 4 root root 12288 Oct 10 21:13 lib32 lrwxrwxrwx 1 root root 4 Jun 14 2010 lib64 -> /lib drwx------ 2 root root 16384 Jun 14 2010 lost+found drwxr-xr-x 2 root root 4096 Jun 14 2010 media drwxr-xr-x 2 root root 4096 Jun 1 2010 mnt drwxr-xr-x 2 root root 4096 Jun 14 2010 opt dr-xr-xr-x 111 root root 0 Oct 10 21:14 proc drwx------ 12 root root 4096 Oct 10 22:11 root drwxr-xr-x 2 root root 4096 Aug 28 10:14 sbin drwxr-xr-x 2 root root 4096 Mar 28 2010 selinux drwxr-xr-x 2 root root 4096 Jun 14 2010 srv drwxr-xr-x 13 root root 0 Oct 10 21:14 sys drwxrwxrwt 6 root root 6144 Oct 11 19:17 tmp drwxr-xr-x 12 root root 4096 Aug 28 2010 usr drwxr-xr-x 15 root root 4096 Aug 19 2010 var lrwxrwxrwx 1 root root 31 Jun 14 2010 vmlinuz -> boot/vmlinuz-2.6.32-5-xen-amd64
These two examples show the ls and ls -l examples. differeces include permisions on left, place is next, owned by and located at are the next two parts, number of charecters is next, last date edited and name.
Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.
If you run a program you made and you use a path to activate it from another location. Do you go to the program or does the program run where you are?
All information based on in class lectures.
I believe that the program will come to me.
Because I am opening a path to the program. We discussed in class that it is possible to form shells within the shell you are already in. I believe that the program will form around me and then leave after its completion.
I am going to test it by entering a directory not near my program and activate it using a path. Within the program i added 'pwd' which allows the program to display its current location.
lab46:~/bin$ script1 please enter your name: ls hi, ls, how are you?ls Oh so your ls . Well I don't GIVE a care :p /home/cforman/bin
this was a test to show what the program will do. once the program finishes it will display its location.
lab46:~/bin$ cd ../../../usr lab46:/usr$ ~/bin/script1 please enter your name: bob hi, bob, how are you?sad Oh so your sad . Well I don't GIVE a care :p /usr
This shows that I went to the usr directory and made a path to my script. It ran in usr although it was not made or saved there.
Based on the data collected:
It can be concluded that when you run a script from a different location using a path to its, that you will not go to it but it will come to you. One interesting discovery is that not only does it run at your location but will form a bubble around as it runs.
If we change location from within a script instead of just calling it to us, will we follow it to the area that it relocates to or stay where we were?
Used information gathered in class…. basic scripting and location checking.
I believe i will stay where I started the program based on the last experiment. Changing the location in a file unless it tells the user to move somewhere the program should just move to the area of affect like it formed a shell around the user when you make a path to it.
I am going to go to the usr directory and make a path to it
lab46:~$ cd tmp lab46:~/tmp$ touch testsubject.sts lab46:~/tmp$ ls file haha hola killyou mwajajaja testsubject.sts lab46:~/tmp$ cd lab46:~$ cd ../../usr lab46:/usr$ ~/bin/script4 mv: missing destination file operand after `.hi' Try `mv --help' for more information. mv: `file' and `file' are the same file mv: `haha' and `haha' are the same file mv: `hola' and `hola' are the same file mv: `killyou' and `killyou' are the same file mv: `mwajajaja' and `mwajajaja' are the same file `testsubject.sts' -> `testsubject' /home/cforman/tmp
This shows that in fact temporarily i did go to the temp file.
Based on the data collected:
In the end I was only half correct. I did not take into account that in the shell i could travel somewhere else then when the shell disappears I return to where I was.
What is the question you'd like to pose for experimentation? State it here.
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.
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.
How are you going to test your hypothesis? What is the structure of your experiment?
Perform your experiment, and collect/document the results here.
Based on the data collected:
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.