User Tools

Site Tools


user:cforman:portfolio:project3

Project: ARCHIVE HANDLING

A project for CSCS1730 UNIX/Linux Fundamentals by YOUR NAME OR GROUPMEMBER NAMES during the SEMESTER YEAR.

This project was begun on DATE and is anticipated to take X AMOUNT OF TIME. (Upon completion you can correct this with the actual length).

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

The purpose of this project is to allow me to explore archiving. I will explore it in the fact of zip archives. I will learn how to zip and unzip files. I had to look up information to check and see if the command was obvious to zip and unzip a file. http://en.wikipedia.org/wiki/Cp_%28Unix%29 Unzip was easy to guess but zipping a file took some time to figure out. I used “man” to discover the pattern but took some time to really use it. Using this site and my knowledge of cp, The command -r is required to copy a directory into a archive. gzips are more difficult. http://linux.about.com/od/commands/l/blcmdl1_gzip.htm This site described the gzip commands and The file we are dealing with is a tar.gzip file and this page describes how to expand it. After expanding them they go to a designated archive file and that using the informantion from man can then be zipped into an archive.

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

Describe the process you took to accomplish this project here,

lab46:~$ cp -r /var/public/unix/archives/archive1.tar.gz /home/cforman
lab46:~$ ls
Maildir          cake    irc          puzzlebox       src.orig  tmp
archive1.tar.gz  closet  motd         shellscripting  testdir   vitest
bin              data    public_html  src             testdir2
lab46:~$ cp -r /var/public/unix/archives/archive2.zip /home/cforman
lab46:~$ ls
Maildir          bin     data  public_html     src       testdir2
archive1.tar.gz  cake    irc   puzzlebox       src.orig  tmp
archive2.zip     closet  motd  shellscripting  testdir   vitest
lab46:~$ archive2.zip -Z
-bash: archive2.zip: command not found
lab46:~$ -Z archive2.zip
-bash: -Z: command not found
lab46:~$ man -Z
What manual page do you want?
lab46:~$ -Z
-bash: -Z: command not found
lab46:~$ unzip archive2.zip
Archive:  archive2.zip
   creating: archives/
 extracting: archives/filea          
 extracting: archives/filez          
   creating: archives/dir1/
lab46:~$ ls
Maildir          archives  closet  motd         shellscripting  testdir   vitest
archive1.tar.gz  bin       data    public_html  src             testdir2
archive2.zip     cake      irc     puzzlebox    src.orig        tmp
lab46:~$ cd archives
lab46:~/archives$ ls
dir1  filea  filez
lab46:~/archives$ cat filea
This contains text.
lab46:~/archives$ cat filez
lab46:~/archives$ ls
dir1  filea  filez
lab46:~/archives$ nano filea
lab46:~/archives$ cd dir1
lab46:~/archives/dir1$ ls
lab46:~/archives/dir1$ ls
lab46:~/archives/dir1$ cd ..
lab46:~/archives$ nano filez
lab46:~/archives$ cd
lab46:~$ unzip archive1.tar.gz
Archive:  archive1.tar.gz
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of archive1.tar.gz or
        archive1.tar.gz.zip, and cannot find archive1.tar.gz.ZIP, period.
lab46:~$ tar -xzf archive1.tar.gz
lab46:~$ ls
Maildir          archives  closet  motd         shellscripting  testdir   vitest
archive1.tar.gz  bin       data    public_html  src             testdir2
archive2.zip     cake      irc     puzzlebox    src.orig        tmp
lab46:~$ cd archives
lab46:~/archives$ ls
abc.txt  dir1  filea  fileb  filec  filez
lab46:~/archives$ cat abc.txt
This is an example file for use in CT173.
lab46:~/archives$ cat fileb
lab46:~/archives$ cat file c
cat: file: No such file or directory
cat: c: No such file or directory
lab46:~/archives$ cat filec
lab46:~/archives$ ls
abc.txt  dir1  filea  fileb  filec  filez
lab46:~/archives$ cat filez
lab46:~/archives$ cd dir1
lab46:~/archives/dir1$ ls
lab46:~/archives/dir1$ cd ..
lab46:~$ ls
Maildir                 archives  data         puzzlebox       testdir
archive1.tar.gz         bin       irc          shellscripting  testdir2
archive2.zip            cake      motd         src             tmp
archivecompilationfile  closet    public_html  src.orig        vitest
lab46:~$ tar -cvf archives.tar archives
archives/
archives/dir1/
archives/abc.txt
archives/fileb
archives/filec
archives/filea
archives/filez
lab46:~$ ls
Maildir                 archives      cake    motd            src       tmp
archive1.tar.gz         archives.tar  closet  public_html     src.orig  vitest
archive2.zip            archives.zip  data    puzzlebox       testdir
archivecompilationfile  bin           irc     shellscripting  testdir2
lab46:~$ bzip2 archives.tar
lab46:~$ ls
Maildir                 archives          cake    motd            src       tmp
archive1.tar.gz         archives.tar.bz2  closet  public_html     src.orig  vitest
archive2.zip            archives.zip      data    puzzlebox       testdir
archivecompilationfile  bin               irc     shellscripting  testdir2
lab46:~$ 

I first looked up how to properly copy files from directories and moved the zipped files to my home directory. After that i played around to figure out what was in each file after unzipping it using the unzip command then file name. I looked up the man for zip and found out how to send all the data in the directory into the zip file after some prompting from my teacher i remembered the -r argument from the website that i found to copy allowing me to send all the contents of the directory to a zip folder called archives.zip. <(^^,)>

Reflection

Archiving makes it easy to move extremely large files. Its kind of a waste to archive small files but this project was a great example in unzipping and zipping files. The archive doesn't disappear after extracting its contents and i thought this weird and good. Windows and other such programs just expand everything and sometimes remove the archive. This makes it so you can get whats inside and save it for later in case you need to re-grab the files. In conclusion the project was a success and the files after some testing were extracted and put into a new archive. <(^^,)>

References

user/cforman/portfolio/project3.txt · Last modified: 2011/10/25 15:06 by cforman