Sie sind auf Seite 1von 6

Technological Institute of the Philippines

COE007 – Computational Thinking with Python

Laboratory 7 – Archiving and Compression

Name: Sta. Romana, John Benedick G. Date: July 2, 2018


Section: CPE41FC1 Instructor: Engr. Alonica Villanueva

7.2.1

cd
mkdir mybackups
tar –cvf mybackups/udev.tar /etc/udev
ls mybackups

The tar(Tape Archive) command is used to create an archive file of the /etc/udev directory, it is also
used to merge multiple files into a single file. By default it does not compress the data.The –c option
tells the tar command to create a tar file. The –v option stands for verbose which instructs the tar
command to demonstrate what it is doing.The –f option is used to specify the name of the tar file


7.2.2

tar –tvf mybackups/udev.tar – displays the content of a tar file, t = list of contents v = verbose, f
=filename

7.2.3

tar –zcvf mybackups/udev.tar.gz /etc/udev


ls –lh mybackups
z option – z option in a command will creates a tar file that is compressed and it also makes use of the
gzip utility to perform compression
7.2.4

cd mybackups
tar –xvf udev.tar..gz
ls – list contents in a directory
ls etc – list contents in etc directory
ls etc/udev – list contents in udev directory
ls etc/udev/rules.d –this command with arguments extracts the content of an archive

7.2.5

tar –rvf udev.tar /etc/hosts


tar –tvf udev.tar – This command will add a file to the existing archive and verifies the existence of the
new file in the tar archive
7.2.6

cp /usr/share/dict/words
gzip words - this command use to compress words
ls –l words.gz - gzip and gunzip is used to compress and uncompress a file. It is used here to compress
a copy of the words file

7.2.7

ls -1 words.gz
gunzip words.gz
ls -1 words - uncompresses the words.gz file

7.2.8

ls –l words
bzip2 words
ls –l words.bz2 - same with gzip and gunzip, bzip2 and bunzip2 compresses and uncompresses a file.
It is used here to compress a copy of the words file
7.2.9

ls -1 words.bz2
bunzip 2 words.bz2
ls -1 words - uncompresses the words.bz2 file

7.2.10

zip words.zip words


ls –l words.zip- this command compresses the words file

7.2.11

zip –r udev.zip /etc/udev


ls –l udev.zip – this command will compress the etc/udev directory and its contents
7.2.12

unzip –l udev.zip – views the content of a zip archive

7.2.13

unzip udev.zip – this command main function is to extract the zip archive

Das könnte Ihnen auch gefallen