Monday, September 7, 2009

Basic Tip

List of commands:

1. How to compress the file?
2. How to zip multiple files & directory?
3. How to gzip a file?
4. How to bzip a file?
5. How to view the format of the files?


OUTPUT:
bash-3.00# compress list

bash-3.00# gzip list1

bash-3.00# bzip2 list2

bash-3.00# zip test.zip new list1 list2 list3
zip warning: name not matched: list1
zip warning: name not matched: list2
adding: new/ (stored 0%)
adding: list3 (deflated 75%)

bash-3.00# tar cvf test.tar list6 list5
a list6 34K
a list5 34K

bash-3.00# ls -lh
total 492
-rw-r--r-- 1 root root 12K Sep 7 03:48 list.Z
-rw-r--r-- 1 root root 8.4K Sep 7 03:48 list1.gz
-rw-r--r-- 1 root root 7.9K Sep 7 03:48 list2.bz2
-rw-r--r-- 1 root root 34K Sep 7 03:48 list3
-rw-r--r-- 1 root root 34K Sep 7 03:48 list4
-rw-r--r-- 1 root root 34K Sep 7 03:48 list5
-rw-r--r-- 1 root root 34K Sep 7 03:49 list6
drwxr-xr-x 2 root root 512 Sep 7 03:49 new
-rw-r--r-- 1 root root 70K Sep 7 03:50 test.tar
-rw-r--r-- 1 root root 8.6K Sep 7 03:49 test.zip

NOTE:
Here
-h = displays the size of file & directory in human readable format (ie, in terms of kb,mb & gb)

bash-3.00# file new
new: directory

bash-3.00# file list5
list5: ascii text

bash-3.00# file list.Z
list.Z: compressed data block compressed 16 bits

bash-3.00# file list1.gz
list1.gz: gzip compressed data - deflate method , original file name

bash-3.00# file list2.bz2
list2.bz2: bzip2 compressed data , block size = 900k

bash-3.00# file test.tar
test.tar: USTAR tar archive

bash-3.00# file test.zip
test.zip: ZIP archive

No comments:

Post a Comment