0% found this document useful (0 votes)
2 views2 pages

Linux File Archive

The document outlines a series of tasks related to file management and compression using various tools in a command-line environment. It includes creating a directory, converting it to a tar file, compressing it with gzip, bzip2, and xzip, and extracting files from tar archives. Additionally, it provides syntax for file sharing using SCP, emphasizing the need for the -r option when transferring folders.

Uploaded by

Pranit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Linux File Archive

The document outlines a series of tasks related to file management and compression using various tools in a command-line environment. It includes creating a directory, converting it to a tar file, compressing it with gzip, bzip2, and xzip, and extracting files from tar archives. Additionally, it provides syntax for file sharing using SCP, emphasizing the need for the -r option when transferring folders.

Uploaded by

Pranit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

__________________________________________________________

Task 1 :-

#cd Desktop
#mkdir mydata
#cd mydata
#touch {1..10000}
#cd .. ----> exit from folder

Task 2 :- convert folder into tar file, without this operation we can't apply tools
for compression
#tar -cvf myfile.tar mydata ----> by using this command , mydata convert
into myfile.tar
#du -sh myfile.tar ----> check size of file

Task 3 :- #gzip mydata.tar


----> compress folder
#du -sh mydata.tar.gz ----> check size after compression
#gunzip mydata.tar.gz ----> used to remove gz extention

Task 4 :- Perform Compression by using bzip2 tool


#bzip2 myfile.tar
#bunzip2 myfile.tar.bzip2 ----> used to remove bz2 extention of
file

Task 5 :- Perform compression by using xzip tool


#xz myfile.tar
#unxz myfile.tar.xz ---> used to remove xzip extention

______________________________________________________________

How to list out data of tar file

#tar -tvf myfile.tar.gz or bzip2 or xz

[note :- make sure by using this command we can't gain access of data , this
command helps only for view data]

________________________________________________________________

How to extract file


#tar -xvf myfile.tar.gz

_________________________________________________________________

File Sharing

syntax : -

#scp <file/foldername> <ip address of Destination:/<Location>


Example :- scp ninja.png 192.168.1.76:/root/Desktop

[note :- make sure if you want to send folder so before folder name -r option is
mandatory , -r recurssivly ]
Example :- #scp -r myfolder 192.168.1.76:/root/Desktop

____________________________________________________________________

You might also like