======Part 3====== =====Entries===== ====Entry 1: November 2, 2012==== Today we experimented with running something on one system but displaying it on another system. We did this by using variations of the xterm command. For example we ran xeyes, on our own terminal but would send the output to a different terminal with the following command line: lab46:~$ xeyes -display flake01.2 When you run a process like this in the foreground, you cannot work on anything else until you Ctrl C out of the process. However, there is an option to run processes in the background. If you use the & at the end of a command line, this will put the process in the background so that you can work on other items. lab46:~$ xeyes -display flake01.2 & It is important to remember, that you can't Ctrl C out of a a process that is running in the background. You have to kill the process in the command line. lab46:~$ kill xeyes ====Entry 2: November 09, 2012==== Today we discussed the tail and head commands. The tail command allows you to grab the last lines of a file or a previous command output. The default number of lines that the tail command grabs is ten, however you can specify how many of the end lines you want to grab by adding -n to the tail command. **Example** lab46:~$ last | cat -n | tail -5 906 lalexan3 pts/33 10.100.60.118 Thu Nov 1 11:03 - 12:06 (01:03) 907 jpettie pts/29 rrcs-184-74-43-2 Thu Nov 1 09:59 - 12:21 (02:21) 908 wedge pts/19 10.80.81.2 Thu Nov 1 07:22 - 11:10 (03:47) 909 910 wtmp begins Thu Nov 1 07:22:52 2012 The head command does just the opposite. It grabs the first lines. **Example** lab46:~$ last | cat -n | head -5 1 csimon1 pts/83 grrasp.offbyone. Wed Nov 14 15:46 still logged in 2 wedge pts/79 grrasp.offbyone. Wed Nov 14 15:42 still logged in 3 jcavalu3 pts/77 caprisun.offbyon Wed Nov 14 15:39 still logged in 4 dsherbur pts/33 grrasp.offbyone. Wed Nov 14 15:37 still logged in 5 wedge pts/76 grrasp.offbyone. Wed Nov 14 15:36 still logged in As seen above, the cat -n command, numbers the lines of output. This is extremely useful in order to search and grab lines. We were also given a list of other helpful commands to look up and research. - paste - comm - diff : compares files line by line and can create a patch - join : concatenate file - patch : can apply the patch created by diff to a file - sort: - uniq: ====Entry 3: November 16, 2012==== Today we discussed networking, with networking being defined as communication among devices between a common medium using common protocols. - Standard: The way things should be done (Ex. OSI) - Protocol : Set of Rules or the actual instantiation of a process. (Ex. TCP / IP) - Actual: TCP / IP - Layers: Distinct Protocols - Application - Transport - Networking - Data Link A computer needs consistency and therefore needs to adhere to protocols. Every computer on a network has a unique IP address. Example: 10.80.2.83 - The first number defines wether or not the address is accessible over the internet (public) or not (private). Private IP's tend to start with 10, 172, 127, or 192. - The second number is a location number (i.e.. lair, campus) - The third number is a subnet for organizing resources (admin, project, general project) - The last number is the unique node # of the computer. ====Entry 4: November 30, 2012==== With this being the last official class for November, I leave this class with just the final project left to accomplish. I definitely feel like I have gained a vast amount of information about the Unix system. I feel that I am well equipped to continue experimenting with the Unix system, however there are still some areas in which I struggle. I tend to make things more complicated then they are, so with the simplistic philosophy of the Unix system, I feel that there must be more efficient ways to accomplish tasks then the way that I am trying to do them. I still need to learn the most simplistic ways to combine commands in order to accomplish a task. I guess with time and practice, I will get the hang of it. =====Keywords===== {{page>unixpart3&nofooter}} =====Experiment 3===== ====Question==== How does the tail command with the -f option work? ====Resources==== Unix Man Page : The -f option allows you to follow a file and receive updated output as the file gets bigger. **__Harley Hahn's Guide to Unix and Linux__**: You can use the -f option of tail either in the foreground or background. If you run in the foreground, you cannot enter anymore commands in the command line until the tail command is halted. An option here is to run the tail command in the foreground of a separate terminal window and Ctrl C when you wish to end the command. If you run in the background with the &... you can monitor a growing file while you work on something else. You have to use the kill command to end the tail process. ====Hypothesis==== Based on what I have read, the tail -f command monitors a file for changes in the number of lines in the file, and outputs changes as lines are added to a file, therefore, I believe that when I run the command on a file that I create for monitoring, it will initially spit out the last lines of the file. When I update the file, it will display the new lines that I add to the file. ====Experiment==== How are you going to test your hypothesis? What is the structure of your experiment? * - I am going to open two terminal screens. * - In the first terminal window, I will create a file named lastExp, and enter information into that file lab46:~$ cat > finalExp * - In the second terminal window, I will run the tail -f command on the lastExp. lab46:~$ tail -f lastExp * I will then update the lastExp file in the first terminal window, and watch the second terminal window for updates. * When I have finished updating the lastExp file, I will Ctrl D out of the first terminal window, and Ctrl C to end the tail -f process in the second terminal window. ====Data==== **First terminal session** lab46:~$ cat > finalExp This is just a test file to test the tail -f command and follow option. I will be running the tail -f command in the foreground, so I will have two terminal windows open. I hope that this works the way I am hoping. lab46:~$ cat >> finalExp Okay, now I am adding additional lines to my file. Hopefully this line will appear on the other terminal screen. It worked! Everything that I am typinng on this screen is appearing on the other terminal screen! Yes! Experiment Completed for tonight! ^D **Second terminal session** lab46:~$ tail -f finalExp This is just a test file to test the tail -f command and follow option. I will be running the tail -f command in the foreground, so I will have two terminal windows open. I hope that this works the way I am hoping. Okay, now I am adding additional lines to my file. Hopefully this line will appear on the other terminal screen. It worked! Everything that I am typinng on this screen is appearing on the other terminal screen! Yes! Experiment Completed for tonight! ^C ====Analysis==== Based on the data collected: * My hypothesis was correct! The lines that were being added to the file in the first terminal session were updated in the second terminal session with the tail -f command/option. ====Conclusions==== The tail -f option could be a useful tool for monitoring logins and updates to files. However, as it appears to only give additional lines to a file, it would only be useful for monitoring appends or additions to files, and not for monitoring internal changes to existing information.