Introduction to Linux


Basic commands for your research
Useful Linux commands
Some of the general tips for Linux commands
How to use grep, find , wc, and diff commands
How to extract and archive files
How to use other's Linux...when you do not have your own Linux system.

How to extract and archive files

The tar, which stands for "tape archiver", in general archives files and extracts files from an archived file. The specified commands follow "tar" and the qualifiers modify what the commands do. Thus, the style is a little different from the above commands. The followings are the basic commands:
cCreates an archive.
AAppends tar files to an archive.
dCompares an archive to files on disk.
tLists the contents.
xExtracts files from a tar archive.

The qualifiers are:
fUses the file called "file" on the computer called host as the archive file.
jProcesses through bz2 compression.
MCreates (extracts from) multiple archives.
vShows all of the lists archived or extracted.
zProcesses through gunzip.

This archives the all files in directory, "mydirect", as mine.tar.
$ tar cvf mine.tar mydirct/
This extracts files from mine.tar.
$ tar xvf mine.tar
You can also choose files you want to archive.
$ tar cvf research.tar data1.txt data2.txt data3.txt
The tar just archives the files and it does not compress the series of files. If you want to compress the files with gzip, type as folloes:
$ tar zcvf mine.tar.gz file1.txt file2.txt file3.txt
To extract files from the archive,
$ tar zxvf mine.tar.gz
If you want to add the file(s) in a tar archive, you type:
$ tar rf mine.tar file1.txt
To look at the files inside the archive without extracting, you will trype:
$ tar tf mine.tar

Back to Electronics Page

Back to Hiro's Physics Main