LAB 02

LAB 02 - LAB 02 - UNIX, continued Introduction This lab is...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
LAB 02 - UNIX, continued Introduction This lab is intended to introduce techniques that will allow you to work efficiently and effectively the UNIX command line. Last lab introduced the command line and provided enough information for you to perform simple tasks. However, it barely scratched the surface of the UNIX environment. This lab is intended to dig deeper. Unfortunately, UNIX is too complex to be fully explained in a two hour lab. Thus, this lab provides detailed explanation of a few topics that will particularly helpful in the upcoming semester, as well as a broad overview of other UNIX topics. Ideally, this lab will serve as a starting point for you to explore UNIX on your own. Downloading files For this lab, we have created a directory to help demonstrate some more complex elements of UNIX. Accordingly, you first need to download and extract the archive containing this directory. You could of course accomplish this using the GUI, but it is advantageous to learn the command line way, since at some point you might need to do so remotely, without access to the GUI. You can download files using the wget command with a URL. Download the archive for this lab: $ cd ~/cs180 $ wget http://cs.purdue.edu/homes/dthornb/lab02.tar.bz2 $ ls … lab02.tar.bz2 … Archives Once you have the archive file, you need to extract it, pulling the files and directories contained inside it out into the current directory. Note the filename extension on the archive: .tar.bz2 . This indicates that the file is a tar (tape archive) file, compressed using a tool called bzip 2. You may also encounter .tar.gz files, which use a older compression scheme called gzip . In Unix, archives are created in two stages. First, the files and directories are bound together in a tar file , which just contains the contents of the files, stored along with some indexing information. Then, the tar file is compressed using a program like gzip , or bzip2 . These compressors can only compress one file at a time. Although creating (and extracting) UNIX archives is really a two stage process, many modern UNIXes automatically call bzip2 and gzip , meaning you can perform the whole process using just the tar command. Extract the lab’s archive using tar : $ tar -xvf lab02.tar.bz2 $ ls The x option means “extract”, the v option means “verbose”, which causes the name of every file and directory in the archive to be printed, and the f option specifies the file on which to operate (the file name argument belongs to the f option, not to the tar command itself). Try creating an archive using some of the files you just extracted: $ cd lab02 $ ls $ tar -cvf test.tar.bz2 testfile* $ ls … test.tar.bz2 … This command creates an archive called test.tar.bz2 from the files beginning with testfiles . Note that the argument to the f option specifies the name of the archive, while second argument, the argument to tar itself, specifies the names of the files to put in the archive. To earn points for this section of the lab, create an archive
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

LAB 02 - LAB 02 - UNIX, continued Introduction This lab is...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online