Home » Linux Host, Ubuntu, SysAdmin » Linux Commands » How to Compress files using 7z in Linux ?

How to Compress files using 7z in Linux ?

7-Zip is a file archiver with a high compression ratio. Using 7 zip we can compress the directory and its all files to reduce the size when we upload to somewhere or send it to others thus reducing the time and bandwidth required.

To compress files / directories using 7z command, we need to install “p7zip-full” package as below,

$ sudo apt install p7zip-full

Now, it we have a the directory say “helloworld” which contains all the files and folders which we want to compress, then we can use below command to create the compressed archive with name “helloworld.7z” as below,

$ 7z a helloworld.7z helloworld/

Note: we have added “a” in between “7z” command and “helloworld.7z” file which is an option for compressing.

So, the command is,

$ 7z a "compressed_file_name.7z" folder_to_be_compressed/

How to extract 7z file in Linux ?


Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment