How to Install 7Zip on Ubuntu 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.

On Ubuntu 7Zip command can be installed by installing “p7zip-full” package as below,

$ sudo apt install p7zip-full

7Zip supports following arguments,

Usage: 7z <command> <archive_name> [<file_names>...]

<Commands>
  a : Add files to archive
  b : Benchmark
  d : Delete files from archive
  e : Extract files from archive (without using directory names)
  h : Calculate hash values for files
  i : Show information about supported formats
  l : List contents of archive
  rn : Rename files in archive
  t : Test integrity of archive
  u : Update files to archive
  x : eXtract files with full paths

The most common use of 7zip is for compressing and uncompressing files.

Compress / Archive Files using 7Zip

Now, if 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/

Extract / UnCompress files using 7Zip

Now, if we have a 7 zip compressed file as “helloworld.7z” , then we can extract the same file as,

$ 7z x helloworld.7z

Note: we have added “x” in between “7z” command and “helloworld.7z” file which is an opt

Leave a Comment