======Project: ARCHIVE HANDLING====== A project for CSCS1730 UNIX/Linux Fundamentals by Derek Girard3 during Fall 2011. This project was begun on 10/24/11 and is anticipated to take 1 day. =====Objectives===== To demonstrate familiarity with archiving and compression tools. =====Prerequisites===== In order to successfully accomplish/perform this project, the listed resources/experiences need to be consulted/achieved: * ability to use the command-line * familiarity with looking up information and documentation * understanding what files are =====Background===== This project is here to help me understand the compression and decompression of files. It can be also known as archiving, extracting data and putting them into a smaller more convenient space for you to extract later on. You take the data as its original form and when you compress it you break it down into smaller bits. Its no longer usable to you until you decompress it into its original state. There are many types on archiving tools like zip and tar. They basically all do the similar function but have differences which makes them stand out. http://it.toolbox.com/blogs/shell-scripting/linux-archiving-techniques-6443 =====Scope===== In **/var/public/unix/archives** are two files: **archive1.tar.gz** and **archive2.zip** Your mission is to: * make a copy of them to your home directory * figure out how to properly extract each one * view the contents * create a new archive containing the contents of both extracted original archives * compress your new archive in bzip2 format * document the entire process to clearly demonstrate this (ie showing command-lines) on your project document =====Attributes===== State and justify the attributes you'd like to receive upon successful approval and completion of this project. * commands: using various archiving and compression commands * files & directories: understanding files and directories =====Procedure===== First i copied the two archives into my home directory(~): lab46:~$ cd /var/public/unix/archives lab46:/var/public/unix/archives$ cp -a archive.tar.gz archive2.zip ~ cp: cannot stat `archive.tar.gz': No such file or directory lab46:/var/public/unix/archives$ man cp lab46:/var/public/unix/archives$ cp -a archive.tar.gz ~ cp: cannot stat `archive.tar.gz': No such file or directory lab46:/var/public/unix/archives$ cp -a archive1.tar.gz ~ lab46:/var/public/unix/archives$ cd lab46:~$ ls Maildir bin contact.info.save hey irc program scriptrgex.sh temp.c a.out botopen data hi killerwasp.sh program.c soaringeagle.sh tmp addscr.sh candy destructo.sh hi.c lab1a.text pss soaringeagle1.sh wildcards archive1.tar.gz closet dl hi.s motd public_html src archive2.zip cmdcprog.c exper in newdirectory regularexpressions temp lab46:~$ I noticed that i messed up the first copy by miss spelling a word but it was interesting how it still copied one while the line had a incorrect statement, so in the end both were copied over. next i extracted data from the archive1.tar.gz file. lab46:~$ ls Maildir bin contact.info.save hey irc program scriptrgex.sh temp.c a.out botopen data hi killerwasp.sh program.c soaringeagle.sh tmp addscr.sh candy destructo.sh hi.c lab1a.text pss soaringeagle1.sh wildcards archive1.tar.gz closet dl hi.s motd public_html src archive2.zip cmdcprog.c exper in newdirectory regularexpressions temp lab46:~$ man tar lab46:~$ tar xvf archive1.tar.gz archives/ archives/abc.txt archives/filea archives/fileb archives/filec lab46:~$ ls Maildir archives cmdcprog.c exper in newdirectory regularexpressions temp a.out bin contact.info.save hey irc program scriptrgex.sh temp.c addscr.sh botopen data hi killerwasp.sh program.c soaringeagle.sh tmp archive1.tar.gz candy destructo.sh hi.c lab1a.text pss soaringeagle1.sh wildcards archive2.zip closet dl hi.s motd public_html src lab46:~$ cd /archives -bash: cd: /archives: No such file or directory lab46:~$ cat archives/abc.txt This is an example file for use in CT173. lab46:~$ cat archives/filea lab46:~$ cat archives/fileb lab46:~$ cat archives/filec lab46:~$ cat archives/ cat: archives/: Is a directory lab46:~$ cd archive -bash: cd: archive: No such file or directory lab46:~$ cd archives lab46:~/archives$ ls abc.txt filea fileb filec lab46:~/archives$ next i extracted data from the zip file "archive2": lab46:~$ unzip -j archive2 Archive: archive2.zip extracting: filea extracting: filez lab46:~$ ls Maildir bin data hey killerwasp.sh pss src a.out botopen destructo.sh hi lab1a.text public_html temp addscr.sh candy dl hi.c motd regularexpressions temp.c archive1.tar.gz closet exper hi.s newdirectory scriptrgex.sh tmp archive2.zip cmdcprog.c filea in program soaringeagle.sh wildcards archives contact.info.save filez irc program.c soaringeagle1.sh lab46:~$ cat filea This contains text. lab46:~$ cat filez lab46:~$ And here is where i create my new archive and compress it into a bzip2 archive: lab46:~$ ls Maildir archivees closet dl hi.s motd public_html src a.out archives cmdcprog.c exper in newdirectory regularexpressions temp addscr.sh bin contact.info.save hey irc program scriptrgex.sh temp.c archive1.tar.gz botopen data hi killerwasp.sh program.c soaringeagle.sh tmp archive2.zip candy destructo.sh hi.c lab1a.text pss soaringeagle1.sh wildcards lab46:~$ bunzip2 archives/filea bunzip2: Can't open input file archives/filea: No such file or directory. lab46:~$ bunzip2 archives/filea.bz2 archives/abc.txt.bz2 archives/fileb.bz2 archives/filec.bz2 archivees/filea.bz2 archivees/filez.bz2 lab46:~$ tar -cf archives/filea archives/abc.txt archives/fileb archives/filec archivees/filea archivees/filez lab46:~$ ls Maildir archivees closet dl hi.s motd public_html src a.out archives cmdcprog.c exper in newdirectory regularexpressions temp addscr.sh bin contact.info.save hey irc program scriptrgex.sh temp.c archive1.tar.gz botopen data hi killerwasp.sh program.c soaringeagle.sh tmp archive2.zip candy destructo.sh hi.c lab1a.text pss soaringeagle1.sh wildcards lab46:~$ cd archives lab46:~/archives$ ls abc.txt filea fileb filec lab46:~/archives$ cd lab46:~$ tar -cf Harchives.tar archives/filea archives/abc.txt archives/fileb archives/filec archivees/filea archivees/filez lab46:~$ bzip2 Harchives.tar lab46:~$ ls Harchives.tar.bz2 archivees cmdcprog.c hey killerwasp.sh pss src Maildir archives contact.info.save hi lab1a.text public_html temp a.out bin data hi.c motd regularexpressions temp.c addscr.sh botopen destructo.sh hi.s newdirectory scriptrgex.sh tmp archive1.tar.gz candy dl in program soaringeagle.sh wildcards archive2.zip closet exper irc program.c soaringeagle1.sh lab46:~$ I made a Harchives file in a tar file containing all the contents of the 2 archives i extracted the information from, then i compressed into a bzip2 file and walah! =====Reflection===== I found this project to be easier than expected, i ran into a few problems but it didnt take me long to figure anything out. I have learned how to archive and compress now and i believe this can help greatly with future projects that i will encounter. This was actually a fun project i will not lie :) =====References===== In performing this project, the following resources were referenced: * http://www.techiecorner.com/1423/how-to-extract-bz2-file-in-linux/ * http://google.com (I searched up things that could easily be found on man pages i just didnt know) * http://lowfatlinux.com/linux-tar.html