55:132/22c:160
Using Tar
- Suppose that you have a directory called "class", and in
the
"class" directory there is a subdirectory called "hw9". In the "hw9"
directory are the three files: freq1.v freq2.v clock.v, as shown
below:
class
|
____ hw9 ____
/
|
\
freq1.v
freq2.v clock.v
- Now, if you want want to place EVERYTHING in the directory
of hw9 into a tar file, you can do the following: While in the
"class" directory, type the command:
tar -cvf hw9.tar
hw9
- "-cvf" are flags for Create, Verbose, File, meaning that you are
going to Create the tar file called "hw9.tar". Verbose means that it is
going to list the files as tar puts them into the tar file.
- The general format of the tar command is: tar [-flags]
target_filename
files_or_directory.
- As another example, if you wanted to submit just the files
"freq1.v", and "freq2.v" then you could do:
tar -cvf
freq.tar freq1.v
freq2.v
- This would have to be done while in the hw9
directory.
- It is generally preferable to tar up entire directories as in the
first example, since you are less likely to leave something out.
With this in mind, please make sure that files that you do NOT want to
submit are not in the directory.
- To extract files from a tar file, you would do: tar -xvf hw9.tar
- By convention, tar files should always be given a .tar
suffix.