Using dd I made a data-dump copy of the uptime in /usr/bin and put it into my home directory named howlong. File said that they were executable files, so I chmod'd the howlong to make it executable. They are almost exactly the same. They are both binary files because nothing intelligible can be read when using cat or vi. The data.file file is 8186 bytes. It appears to be in binary.
This week's lab 0xA was about using pipe (|) commands to filter input. Some of these pipe commands are grep, cut, and head. This is very helpful for when you need to sort loads and loads of information into specific information relevant to you. For example if I had a large list of names, if I wanted to find people with the name Zach, I would use the command cat file | grep 'Zach'. Also, one can use the cut command to cut certain parts of a file out. Like using the -d delimiter commands you can cut things separated by certain symbols. Although the default is tab, you can use any symbol such as: :, ;, -, etc. It was a very helpful lab, and I'm now able to use these commands effectively to filter information.
We covered lab 0x9 in class this week and I played a little with it in the lab. I understand that the grep utility is very useful for sorting data and making it into information. Like in class, we used the grep utility to search through 100,000 English words in the UNIX dictionary. We were able to show the words for example, that were 3 letters long, started with a s and ended with a l. Instead of looking for all these by hand, the grep makes our lives much easier. Although I do not completely understand all of the special “wildcards” and how to arrange them to get what I want, I will continue to play with them and learn them.
I copied the source files from the /var/public/UNIX/devel using cp source.c /home/zcicora/devel.
to compile the first c file, I used g++ -o binary helloC.c to compile the second c++ file, I used g++ -o binary2 helloCPP.cc. to compile the third .S file, I used two commands: The first was as -o object.o helloASM.S, then it created object.o, then I used the command ld -o binary3 object.o.
To run all these I used ./binary
helloC.c can't be ran because it's not yet compiled and it is source text.
Doing lab 0x6, and I made the first script using the vi editor. It was unable to run because the permissions were not set to execute. So I used chmod 700 script1.sh and I was able to run it. I also practices using the echo and read commands. The “read” takes input and “echo” displays output.
I finished lab 0x5. I practiced using the “common wildcards”. For example, they are: *, ?, [], [^ ]. I created the 8 files requested by using the touch commands. After I hit the up “up” arrow key to make it much more faster. I also used the STDOUT, STDIN, and STDERR for the lab. I could make an error message go away with the “2>”. It would move that “input” the the /dev/null which is a unix/linux “Blackhole”. I also used echo to append and overwrite my data in the newly created files. Also, I messed with the $PATH, even though I do not completely understand what it is yet. Overall, learned some new things in lab 0x5.
Well it is review week. I am spending the week looking at my notes, practicing UNIX, and of course, doing the urev permission practice. rwxrwxrwx! It is starting to come naturally. Unfortunately, we have not had class this week because of President's Day. Boo hoo! I will enjoy this minor UNIX break, and prepare for the return of labs and projects next week!
Completed the puzzlebox today. It was very fun, and I learned that one can uuencode, zip, gzip, and tar a file many times! By using the commands of gzip, unzip, tar, and uudecode, I was able to get the “results” of the puzzlebox. I wouldn't have been able to do this without the “man” pages and the e-mail Wedge sent out today about “/searching” the man pages! It was very helpful.
Also completed lab 0x3 today. Learned that cat will display a file's text on the command line, but not all if it is too big. The head command shows the top of the file's text and the tail shows the bottom of the file's text. Yesterday in lecture, and today I have learned about the “Amazing” vi editor. It will take some getting used too, but I'm confident I will learn this “moded” editor. I edited the hidden .signature and .plan files in my home directory using vi. At first I could not find them with ls, but remembered that the “.” indicates that the file is hidden. So by using the “man ls” command I learned that “ls -a” displays all files, hidden or not.
Today I did the archives project. When I extracted the archive2.tar.bz2, I had 3 files that were not empty/corrupt and they were: image2.gif, image3.png, and image4.txt. I extracted this archive using the command, “tar -xjvf archive2.tar.bz2”. When I unzipped the archive1.zip, I found 2 files that were not empty or corrupt and they were: image1.jpg and image3.png. I used the command, “unzip archive1.zip” to do this.
After This I had 5 files, and needed to find the 1 corrupt one. So then I put my files in my public_html, used chmod to make them world readable and used http://lab46.corning-cc.edu/~zcicora/filename to view the images. It was determined that image3.png from the .bz2 was corrupt.
This leaves: image1.jpg, image2.gif, image3.png, and image4.txt. In order from smallest to biggest: image1.jpg = biggest.jpg image2.gif = small.gif image3.png = big.png image4.txt = smallest.txt
I used the command, “tar -zcvf myarchive.tar.gz *big.png *biggest.jpg *small.gif *smallest.txt” to make a compressed archive called myarchive.tar.gz!
To check that it was archived and compressed correctly, I used the command, “tar -zxvf myarchive.tar.gz” and it worked.
Week 2 of UNIX/Linux! I have learned a lot so far. I have even replaced Windows on my computer with Linux Mint so I am forced to learn this mysterious OS. So far I love it! It looks better, seems faster, and is new and fun to use. Although I'm still learning how to install programs through the terminal.
This weeks lab 2 was interesting. I learned about the /bin and how it can be in many directories. There is more than 1 bin, it is just based off of the path. Today in lecture I learned different permissions with files. For example drwxr-xr-x means that I, as the user can read, write, and search/execute the file, the group and other(world)can read and search/execute. It is all based on octal numbers. For example, chmod 755 “file” would mean I, as the user would have read, write, and search/execute, but the group and others would only have read and search/execute. Permissions on files can be shown with ls -l. In this lab I created a lab2 directory in my home directory, and gave myself read, write, and search/execute priviledges, but the group had no permissions, and the world had search/execute. Very interesting lab and lecture this week. I learned a lot! :)
-Zach
ps. Below is a picture of my terrible ascii tree showing the route/path to my shelf file!
/\ / \ / \ / \ / \ / \ / /shelf \ / \ / /spells/ \ / \ / /closet/ \ / \ / /zcicora/ \ / \ / /home/ \ / \ / *root*/ \ l___________ ______________l / \ / \ /___________\
One of the biggest challenges I see with this course is it being online. This will be my first online course and I am not sure how I will do with it. Meeting once a week will be very helpful though. This week in lab I learned how to use the UNIX terminal and log into the class' lab46. Plus I opened a screen to the class chat. This UNIX operating system seems awesome. I feel like I am wielding the power of the force when I am typing commands into the terminal. So, of course, I had to make my terminal green on black to give me more of an illusion of being powerful. The concepts I am having difficulty with are the terminal commands, but I am sure that over time, they will come very easily to me. I am looking forward to UNIX/Linux!