Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

lecture 18 -----> zip / unzip

{ Also use tar command for zip & upzip}


--> doing archiving and compressing also

------------------------------------------->
syntax--->

tar option archive-folder file&folder

--------------------------------------------

///use tar command --->///

/// Archiving the folder--->


# mkdir /mydata --> create folder
# cd /mydata/
# du -sh /etc --> check size etc dir
# tar -cvf redhat.tar /etc ---> archiving of etc folder
# ls
# du -sh redhat.tar
# ls

///---> see contant on redhat.tar/// ( for see contant, extract the folder)
# tar -xvf redhat.tar ---> extract on current location
# ls
# tar -tvf redhat.tar --> listing only not extract
# tar - xvf redhat.tar -C /tmp/ --> extract on tmp DIR
# ls
# ls /tmp/

/// compress the folder --->


# tar -zcvf redhat.tar.gz /etc ----> archiving and compressing in genzip
# ls
# du -sh redhat.tar redhat.tar.gz
--------------------------------
# tar -jcvf redhat.tar.bz2/etc ----> archiving and compressing in binzip
# ls
# du -sh redhat.tar redhat.tar.gz redhat.tar.bz2
-----------------------------------
# tar -Jcvf redhat.tar.xz /etc ----> archiving and compressing in xz
# ls
# du -sh redhat.tar redhat.tar.gz redhat.tar.bz2 redhat.tar.xz

// extract -->
# ls
# rm -rf etc/ ---> delete etc folder
# tar -zxvf redhat.tar.gz
# rm -rf etc/
# ls
# tar -jxvf redhat.tar.bz2
# rm -rf etc/
# ls

# tar -Jxvf redhat.tar.xz


# rm -rf etc/
# ls
---------------------------->

# zip sanjay.zip /etc


# ls
# du -sh sanjay.zip
# unzip sanjay.zip
//// # rpm -qa zip or rpm -qa unzip ---> check pachage of zip / unzip ///

///download script ---> ///

# wget "link" ---> dwnd


# ls
# unzip "path"

You might also like