Table of Contents

Case Study 0x3: The Puzzle Box

The third case study in the greatest class I will ever take.

Objectives

Complete the steps outlined in the Unix Tasks to reach the last file in the “Puzzle Box”

Procedure

Copying “file.txt” into my home directory and using the file command to learn about what it is:

lab46:/var/public/unix/file$ ls
abcd.txt  file.txt  submit
lab46:/var/public/unix/file$ cp file.txt ~
lab46:/var/public/unix/file$ file ~/file.txt
/home/adahmane/file.txt: ASCII text

Catting the file:

lab46:~$ cat file.txt 
This is a simple text file. It contains ASCII text.

Compressing the file with gzip and confirming the operation with ls:

lab46:~$ gzip file.txt
lab46:~$ ls | grep file*
file.txt.gz

Using file again to determine what our file really is:

lab46:~$ file file.txt.gz 
file.txt.gz: gzip compressed data, was "file.txt", from Unix, last modified: Fri Dec  6 17:04:29 2013

Unzipping file.txt.gz with gunzip, verifying, rezipping it with fast compression and verifying:

lab46:~$ gunzip file.txt.gz 
lab46:~$ ls | grep file*
file.txt
lab46:~$ gzip --fast file.txt 
lab46:~$ ls | grep file*
file.txt.gz
lab46:~$ file file.txt.gz 
file.txt.gz: gzip compressed data, was "file.txt", from Unix, last modified: Fri Dec  6 17:04:29 2013, max speed

My long and desperate attempt to understand that tar -xf doesn't change the actual file. Only pulling a file out of the archive. Derp.

lab46:/var/public/unix/file$ cp abcd.txt ~/.
lab46:/var/public/unix/file$ cd
lab46:~$ ls
Desktop                Maildir   Templates        archive2.zip  file.txt.gz  script2.sh
Documents              Music     Videos           archives      new.sh       src
Downloads              Pictures  abcd.txt         closet        public_html  src.bak
Firefox_wallpaper.png  Public    archive1.tar.gz  exp.sh        script1.sh
lab46:~$ file abcd.txt
abcd.txt: gzip compressed data, was "abcd.tar", from Unix, last modified: Wed Sep 22 16:02:40 2010, max compression
lab46:~$ file abcd.txt
abcd.txt: gzip compressed data, was "abcd.tar", from Unix, last modified: Wed Sep 22 16:02:40 2010, max compression
lab46:~$ mv abcd.txt abcd.tar
lab46:~$ file abcd.tar 
abcd.tar: gzip compressed data, was "abcd.tar", from Unix, last modified: Wed Sep 22 16:02:40 2010, max compression
lab46:~$ gunzip abcd.tar 
gzip: abcd.tar: unknown suffix -- ignored
lab46:~$ mv abcd.tar abcd.gz 
lab46:~$ gunzip abcd.gz 
lab46:~$ ls
Desktop    Firefox_wallpaper.png  Pictures   Videos           archive2.zip  exp.sh       public_html  src
Documents  Maildir                Public     abcd             archives      file.txt.gz  script1.sh   src.bak
Downloads  Music                  Templates  archive1.tar.gz  closet        new.sh       script2.sh
lab46:~$ file abcd
abcd: POSIX tar archive (GNU)
lab46:~$ tar -xf abcd 
lab46:~$ ls
Desktop    Firefox_wallpaper.png  Pictures   Videos           archive2.zip  exp.sh        new.sh       script2.sh
Documents  Maildir                Public     abcd             archives      file.txt.gz   public_html  src
Downloads  Music                  Templates  archive1.tar.gz  closet        making.waves  script1.sh   src.bak
lab46:~$ file abcd
abcd: POSIX tar archive (GNU)
lab46:~$ tar -xf abcd 
lab46:~$ file abcd
abcd: POSIX tar archive (GNU)
lab46:~$ tar -xf abcd 
lab46:~$ file abcd
abcd: POSIX tar archive (GNU)
lab46:~$ tar -xf abcd 
lab46:~$ file abcd
abcd: POSIX tar archive (GNU)
lab46:~$ tar -xf abcd 
lab46:~$ file abcd
abcd: POSIX tar archive (GNU)
lab46:~$ file making.waves 
making.waves: Zip archive data, at least v2.0 to extract
lab46:~$ unzip making.waves 
Archive:  making.waves
  inflating: unix.text               
lab46:~$ ls
Desktop                Maildir   Templates        archive2.zip  file.txt.gz   script1.sh  unix.text
Documents              Music     Videos           archives      making.waves  script2.sh
Downloads              Pictures  abcd             closet        new.sh        src
Firefox_wallpaper.png  Public    archive1.tar.gz  exp.sh        public_html   src.bak
lab46:~$ cat unix.text 
---------------------------------------------------------------------------
Congratulations! You figured out this Case Study.

To finish, you must perform these two additional steps, which take the
form of command-lines. All you have to do is copy and paste them.

---------------------------------------------------------------------------
Action 1: copy this file to the /var/public/file/submit directory.
--------  Just run the following to perform that action:

cp unix.text /var/public/unix/file/submit/$USER-file.txt && echo "Success"

---------------------------------------------------------------------------
Action 2: mail this file's contents to your instructor as well as
--------  yourself (for proof of submission). Just run the following:

cat unix.text | mail -s "[CS: FILE]" wedge@lab46.corning-cc.edu $USER

NOTE: If successful, you should receive a copy of this file in your e-mail.
---------------------------------------------------------------------------