gzip – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Thu, 03 Nov 2022 07:57:53 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How To Enable Brotli Compression in Apache https://tecadmin.net/how-to-enable-brotli-compression-in-apache/ https://tecadmin.net/how-to-enable-brotli-compression-in-apache/#comments Thu, 01 Jul 2021 09:44:53 +0000 https://tecadmin.net/?p=26417 Just like Gzip, Brotli is also a generic-purpose compression algorithm developed by Google. It compresses data using a combination of modern technologies and algorithms. It is similar in speed to deflate but provides higher compression. Brotli compression is supported by all the major browsers like Chrome, Firefox, Safari, Edge. The Brotli compression is opted by [...]

The post How To Enable Brotli Compression in Apache appeared first on TecAdmin.

]]>
Just like Gzip, Brotli is also a generic-purpose compression algorithm developed by Google. It compresses data using a combination of modern technologies and algorithms. It is similar in speed to deflate but provides higher compression. Brotli compression is supported by all the major browsers like Chrome, Firefox, Safari, Edge.

The Brotli compression is opted by the top tech fortunes like Cloudflare etc. This is the reason, we recommend switching to brotli from the old deflate data compression algorithm.

This tutorial helps you to enable brotli compression in the Apache webserver.

Prerequisites

Shell access to your server with sudo privileged account.

We assume that you already have a running Apache server. Also created a virtual host for the web application.

Step 1 – Installing Brotli

First, install the brotli package on your system. For the Ubuntu and Debian systems, it’s available in the default repositories.

Open a terminal and type:

sudo apt install brotli -y 

This will install the required package containing the algorithm files on your system.

Step 2 – Configure Brotli with Apache

The Apache server contains the Brotli module default. You can enable the brotli module in Apache with the following command.

sudo a2enmod brotli 

Next, you have to configure the Apache virtual host to enable compression with brotli. You need to add the below code in the virtual host configuration file.

<IfModule mod_brotli.c>
    AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/javascript
</IfModule>

After enabling the brotli compression the Virtual host configuration file looks like below:

<VirtualHost *:80>
      ServerAdmin webmaster@localhost
      ServerName example.com
      DocumentRoot /var/www/

      <IfModule mod_brotli.c>
            AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/javascript
      </IfModule>
	
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Save the configuration file and close it. Then reload the Apache service to apply changes.

sudo systemctl restart apache2 

That’s it. You have successfully enabled brotli compression in the Apache server.

Step 3 – Test Compression

Access your web application in a browser and check headers value in the browser console. You need to search for the Content-Encoding value. It must contain br as value, which denotes that the web page is compressed with brotli compression.

The command line heroes can also use curl command to access the header values as below:

curl -I -H 'Accept-Encoding: br' http://example.com 

You will see the result below.

HTTP/1.1 200 OK
Date: Thu, 01 Jul 2021 06:26:54 GMT
Server: Apache/2.4.41 (Ubuntu)
Upgrade: h2,h2c
Connection: Upgrade
Last-Modified: Fri, 05 Feb 2021 08:55:44 GMT
ETag: "33-5ba92fc4cecdf-br"
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Encoding: br
Content-Length: 46
Content-Type: text/html

Check for the value of Content-Encoding option.

Conclusion

This tutorial helped you to configure Brotli compression in the Apache webserver.

The post How To Enable Brotli Compression in Apache appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-enable-brotli-compression-in-apache/feed/ 2
How to Enable Gzip Compression on Nginx Web Server https://tecadmin.net/enable-gzip-compression-on-nginx/ https://tecadmin.net/enable-gzip-compression-on-nginx/#respond Wed, 28 Jan 2015 07:59:08 +0000 https://tecadmin.net/?p=7268 Gzip compression are used for transferring data in compressed format to end users. This reduced website page load time and increases performance. If you are not sure that your site is running with gzip compression or not on Nginx server, Then you can use online gzip compression sites (Given at end of post) to confirm. [...]

The post How to Enable Gzip Compression on Nginx Web Server appeared first on TecAdmin.

]]>
Gzip compression are used for transferring data in compressed format to end users. This reduced website page load time and increases performance. If you are not sure that your site is running with gzip compression or not on Nginx server, Then you can use online gzip compression sites (Given at end of post) to confirm. If it’s already enabled with gzip you don’t need to do anything. But if gzip is not enabled, follow below steps.

  • Read: How to enable Gzip Compression on Apache Server
  • Enable Gzip in Nginx

    To enable gzip compression in Nginx server, Add the following content in Nginx main configuration file or create a separate gzip configuration file with following content.

    # vim /etc/nginx/conf.d/gzip.conf
    
    gzip on;
    gzip_min_length  100;
    gzip_buffers  8 32k;
    gzip_types  text/plain text/css application/x-javascript text/xml application/xml text/javascript;
    gzip_vary on;
    

    After adding above configuration just restart Nginx web server.

    # systemctl restart nginx
    

    Verify Gzip

    Now as your site has been enabled with gzip compression, let’s use one of below online tools to verify gzip is working correctly.

  • http://checkgzipcompression.com/
  • http://www.whatsmyip.org/http-compression-test/
  • Gzip Compression on Nginx

    The post How to Enable Gzip Compression on Nginx Web Server appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/enable-gzip-compression-on-nginx/feed/ 0
    3 Most Popular Tools to Archive Files and Directories in Linux https://tecadmin.net/popular-tools-to-archive-files-and-directories-in-linux/ https://tecadmin.net/popular-tools-to-archive-files-and-directories-in-linux/#respond Sat, 22 Nov 2014 09:11:05 +0000 https://tecadmin.net/?p=6326 There are multiple tools available in Linux system for creating archive files. In this article you will find uses of multiple tools for creating or extracting archive files through command line Tool 1 – Zip zip is the most popular command line archiving utility for Linux systems. Create Archive of File # zip output.zip /var/log/*.log [...]

    The post 3 Most Popular Tools to Archive Files and Directories in Linux appeared first on TecAdmin.

    ]]>
    There are multiple tools available in Linux system for creating archive files. In this article you will find uses of multiple tools for creating or extracting archive files through command line


    Tool 1 – Zip

    zip is the most popular command line archiving utility for Linux systems.

    Create Archive of File

    # zip output.zip /var/log/*.log
    

    Create Archive of Directory

    # zip -r output.zip /var/log
    

    Extract Archive

    # unzip output.zip
    

    Tool 2 – Tar

    Tar is the another most popular command line archiving utility for Linux systems.

    Create Archive of File

    # tar -cf output.tar /var/log/*.log
    

    Create Archive of Directory

    # zip -cf output.tar /var/log
    

    Extract Archive

    # tar -xf output.tar
    

    Tool 3 – Gzip

    Gzip is one more tool for command line users for making archive files. Gzip also supports to take input of data as standard input or through pipe and create zip file.

    Create Archive of File

    # gzip -k access.log
    

    Create zip file of piped data

    # cat /var/log/messages | gzip > messages.gz
    

    Extract Archive

    # gunzip access.log.gz
    

    Combined – Tar + Gzip

    Tar also combined gzip program to enable higher compression level of files. Uisng tar with gzip created files extension will be .tar.gz.

    Create Archive of File

    # tar -czf output.tar.gz /var/log/*.log
    

    Create Archive of Directory

    # zip -czf output.tar.gz /var/log
    

    Extract Archive

    # tar -xzf output.tar.gz
    

    The post 3 Most Popular Tools to Archive Files and Directories in Linux appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/popular-tools-to-archive-files-and-directories-in-linux/feed/ 0
    How to Extract tar.gz File in Linux https://tecadmin.net/how-to-extract-tar-gz-file/ https://tecadmin.net/how-to-extract-tar-gz-file/#respond Sun, 05 Oct 2014 09:49:22 +0000 https://tecadmin.net/?p=6329 A .tar.gz is compression format commonly used in the Unix based operating system. The tar.gz file format is the combination of TAR packaging followed by the GNU zip (gzip) compression. The tar command is used to compress multiple files and create a single archive file. It creates highly compressed file to save more disk space. [...]

    The post How to Extract tar.gz File in Linux appeared first on TecAdmin.

    ]]>
    A .tar.gz is compression format commonly used in the Unix based operating system. The tar.gz file format is the combination of TAR packaging followed by the GNU zip (gzip) compression.

    The tar command is used to compress multiple files and create a single archive file. It creates highly compressed file to save more disk space. The same command is also used to extract, maintain, or modify tar archives via command line .

    This tutorial will help you with the followings:

    1. How to extract .tar.gz file
    2. How to create a .tar.gz file
    3. And list .tar.gz file content without extracting

    How to extract .tar.gz file

    Use tar command with -x (extract), -z (gzip) and -f for the file name. The below example command will extract content of Backup.tar.gz file in the current directory.

    tar -xzf Backup.tar.gz 
    

    This will silently extract .tar.gz file in current directory. Use -v to enable verbose mode.

    To extract content to other directory us option -C (capital C). This will change the extract location of files.

    tar -xvzf Backup.tar.gz -C /opt  
    

    The above command will extract all files under /opt directory.

    How to create .tar.gz file

    Use -c command line option to create a tar archive. The -z option is used to compress with TAR + Gzip.

    The following command will compress all files, directories and subdirectories under the /var/log directory.

    tar -czf Backup.tar.gz /var/log  
    

    In case of absolution path, GNU tar also maintains the directory structure but skipped root (/) in file system. In the above case the archive contains structure as “var/log/” and all files under the log directory.

    You can also specify multiple files names to add them in single archive.

    tar -czf Backup.tar.gz *.log /backup/*.sql /opt/list.txt 
    

    The above command will archive all files with .log extension in current directory. All files with .sql in /backup directory and /opt/list.txt. As the absolute path is used, it will remove the / directory. You will see the message like “tar: Removing leading `/’ from member names”

    How to list .tar.gz file content

    Use -t option to list all files compressed under a .tar.gz file without extracting them. For example, execute on previously created compressed files:

    tar -tvzf Backup.tar.gz  
    
    
    -rw-r--r-- root/root    119783 2019-12-31 06:22:22 file1.txt
    -rw------- root/root    863287 2019-08-14 17:35:58 anaconda.log
    -rw------- root/root         0 2019-12-29 02:17:27 boot.log
    -rw-r--r-- root/root         0 2019-12-29 02:17:26 kdm.log
    -rw-r--r-- root/root     25643 2019-12-29 01:12:35 Xorg.0.log
    -rw-r--r-- root/root     11380 2019-11-24 17:35:39 yum.log
    

    Conclusion

    This tutorial explained you to how to create and extract .tar.gz file on Linux command line. It also helped you to view .tar.gz file content without extracting it.

    For more details visit tar command man pages.

    The post How to Extract tar.gz File in Linux appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/how-to-extract-tar-gz-file/feed/ 0
    Enable Apache Gzip Compression (mod_deflate) in cPanel Account https://tecadmin.net/enable-apache-gzip-compression-mod_deflate-cpanel-account/ https://tecadmin.net/enable-apache-gzip-compression-mod_deflate-cpanel-account/#comments Thu, 02 Jan 2014 11:30:52 +0000 https://tecadmin.net/?p=3797 Apache mod_deflate module is used for compressing content before serving to client. You can configure compression only if your hosting provider has enabled the mod_deflate module in Apache. The WHM administrators can enable Gzip globally for all cPanel accounts using WHM control panel. Non cPanel users can enable gzip in Apache web server or Nginx [...]

    The post Enable Apache Gzip Compression (mod_deflate) in cPanel Account appeared first on TecAdmin.

    ]]>
    Apache mod_deflate module is used for compressing content before serving to client. You can configure compression only if your hosting provider has enabled the mod_deflate module in Apache.

    The WHM administrators can enable Gzip globally for all cPanel accounts using WHM control panel. Non cPanel users can enable gzip in Apache web server or Nginx web server using command line.

    Let’s use the following steps to enable Apache gzip compression using the cPanel web interface.

    Step 1 – Login to cPanel Account

    Firstly login to your cPanel account using the web interface. The default cPanel interface is accessible on ports 2083 (SSL) and 2082 (non-SSL). The default URL of cPanel access could be like:

    https://mydomain.com:2083
    

    Log in with the cPanel credentials.

    Step 2 – Open Optimize Website Panel

    After login in to the cPanel account, You will find the option Optimize Website under the Software section. Just click on Optimize Website icon to open settings.

    Step 3 – Enable Apache Gzip Compression

    On this page, you will find three options to select. Get below details of each option and select the appropriate option.

    • Disabled – Select this option to disable gzip compression for you website and click Update Settings.
    • Compress all content – Select this option to compress all your website’s content and click Update Settings.
    • Compress the specified MIME types – Select this option and input the MIME types in below text box to compress specific files only and click Update Settings. MIME types list on Wikipedia

    and you have all done. You have successfully enabled Gzip compression for your site. Use this link to verify the compression.

    The post Enable Apache Gzip Compression (mod_deflate) in cPanel Account appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/enable-apache-gzip-compression-mod_deflate-cpanel-account/feed/ 24
    How to Enable Gzip Compression in cPanel/WHM Globally https://tecadmin.net/enable-apache-gzip-compression-globally-in-whm-cpanel/ https://tecadmin.net/enable-apache-gzip-compression-globally-in-whm-cpanel/#comments Tue, 31 Dec 2013 07:52:31 +0000 https://tecadmin.net/?p=3761 Apache mod_deflate module is responsible for the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network. mod_deflate is the replacement of mod_gzip which was used with older version of Apache. The users with cPanel access only can also enable the Gzip compression. Follow [...]

    The post How to Enable Gzip Compression in cPanel/WHM Globally appeared first on TecAdmin.

    ]]>
    Apache mod_deflate module is responsible for the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network. mod_deflate is the replacement of mod_gzip which was used with older version of Apache.

    The users with cPanel access only can also enable the Gzip compression. Follow our other article to enable Apache Gzip Compression in cPanel only account.

    The users with root access can use the WHM panel and enable Apache mod_deflate globally for all cPanel users. Let’s follow the below steps to enable apache Gzip compression (mod_deflate) for all cPanel accounts.

    Step 1 – Login to WHM Panel

    You must have the root credentials of your system to get access to the WHM panel. It is required to make changes globally in a cPanel server. The default WHM is accessible on 2087 (SSL) and 2086 (non-SSL) ports.

    Open a web browser and access the WHM Panel:

    https://11.22.33.44:2087
    

    Login with the administrator (root) account.

    Step 2 – Edit Apache Pre VirtualHost

    You need to added your settings in Pre section of Virtualhosts. So it will be loaded by the all Virtualhost in server. Let’s navigate to the below location in WHM:

    Home » Service Configuration » Apache Configuration » Include Editor

    Edit Pre VirtualHost Include (All versions) as per shown in below screenshot:

    cpanel-apache-pre-virtualhost

    You may get this box empty for previously added settings.

    Step 3 – Update Pre VirtualHost

    Append the below configuration to the Pre VirtualHost editor and save it. Don’t overwrite any existing configuration, that are added for other purposes.

    <IfModule mod_deflate.c>
    	# Insert filter
    	SetOutputFilter DEFLATE
    	<IfModule mod_setenvif.c>
    		# Netscape 4.x has some problems…
    		BrowserMatch ^Mozilla/4 gzip-only-text/html
    
    		# Netscape 4.06-4.08 have some more problems
    		BrowserMatch ^Mozilla/4.0[678] no-gzip
    
    		# MSIE masquerades as Netscape, but it is fine
    		BrowserMatch bMSIE !no-gzip !gzip-only-text/html
    
    		# Don’t compress images
    		SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
    	</IfModule>
    
    	<IfModule mod_headers.c>
    		# Make sure proxies don’t deliver the wrong content
    		Header append Vary User-Agent env=!dont-vary
    	</IfModule>
    </IfModule>
    

    The above configuration has been taken from Here. So read this article carefully before implementing it.

    Save the changes and you will get a restart Apache button. Restart Apache service to apply all changes.

    Conclusion

    In this tutorial, you have learned to enable Gzip compression server-wide (globally) on a WHM/cPanel server. Now, use this link to verify your server gzip using one of domain configured on server.

    The post How to Enable Gzip Compression in cPanel/WHM Globally appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/enable-apache-gzip-compression-globally-in-whm-cpanel/feed/ 32
    How To Enable GZIP Compression in Apache on Ubuntu https://tecadmin.net/enable-gzip-compression-apache-ubuntu/ https://tecadmin.net/enable-gzip-compression-apache-ubuntu/#comments Mon, 19 Aug 2013 10:51:58 +0000 https://tecadmin.net/?p=2173 GZIP compression is the process of taking your data and reducing its size by removing unnecessary characters like spaces and punctuation marks. When you use GZIP, the server can compress your data before it sends it to the client. The client then has less work to do when receiving the data, so it can receive [...]

    The post How To Enable GZIP Compression in Apache on Ubuntu appeared first on TecAdmin.

    ]]>
    GZIP compression is the process of taking your data and reducing its size by removing unnecessary characters like spaces and punctuation marks. When you use GZIP, the server can compress your data before it sends it to the client. The client then has less work to do when receiving the data, so it can receive it faster.

    When you send data over a network, there are two main parts: sending and receiving. Sending involves taking your data and sending it from your computer to the server. Receiving involves taking that data and making sure it gets into your computer intact. There are lots of different things that can go wrong along these two lines – from losing power to having bad internet connections. When you compress your data, you reduce both the transmission time and the amount of work that needs to be done on both ends of the line.

  • Read: How to enable Gzip Compression on Nginx Server
  • Enabling Gzip Compression in Apache

    The Ubuntu and Debian system users follow the below steps to enable gzip compression in the Apache server.

    1. First of all, enable the mod_deflate module, which provides gzip compression to the Apache server.
      sudo a2enmod deflate 
      
    2. Once the module is enabled in the Apache server. Create or edit the .htaccess file in your website document root. For example, if the website document root is /var/www/html, then create file as:
      sudo nano /var/www/html/.htaccess 
      

      Append the following snippet to the file.

      # GZIP compression for text files: HTML, CSS, JS, Text, XML, fonts
      <IfModule mod_deflate.c>
          AddOutputFilterByType DEFLATE text/html
          AddOutputFilterByType DEFLATE text/css
          AddOutputFilterByType DEFLATE text/javascript
          AddOutputFilterByType DEFLATE application/javascript
          AddOutputFilterByType DEFLATE application/xml
          AddOutputFilterByType DEFLATE text/plain
          AddOutputFilterByType DEFLATE text/xml
          AddOutputFilterByType DEFLATE font/opentype
          AddOutputFilterByType DEFLATE font/otf
          AddOutputFilterByType DEFLATE font/ttf
          AddOutputFilterByType DEFLATE image/svg+xml
          AddOutputFilterByType DEFLATE image/x-icon
          AddOutputFilterByType DEFLATE application/rss+xml
          AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
          AddOutputFilterByType DEFLATE application/x-font
          AddOutputFilterByType DEFLATE application/x-font-otf
          AddOutputFilterByType DEFLATE application/x-font-opentype
          AddOutputFilterByType DEFLATE application/x-font-truetype
          AddOutputFilterByType DEFLATE application/x-font-ttf
          AddOutputFilterByType DEFLATE application/x-javascript
          AddOutputFilterByType DEFLATE application/xhtml+xml
      </IfModule>

    3. Use the following command to restart the Apache server.
      sudo systemctl restart apache2 
      

    Verify Gzip Compression

    Now that your site has been enabled with gzip compression, let’s use one of below online tools to verify that Gzip is working correctly.

    enable gzip

    Conclusion

    GZIP compression is a technique that reduces the size of data sent over the network. This can be useful when sending large files over a slow connection, or when there is a lot of data to send. By compressing your data, you may be able to reduce the size of your transfer.

    In this tutorial, you have learned about enabling Gzip compression in the Apache web server.

    The post How To Enable GZIP Compression in Apache on Ubuntu appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/enable-gzip-compression-apache-ubuntu/feed/ 8
    Linux tar Command with Useful Practical Examples https://tecadmin.net/linux-tar-command-with-useful-practical-examples/ https://tecadmin.net/linux-tar-command-with-useful-practical-examples/#respond Tue, 16 Apr 2013 06:59:51 +0000 https://tecadmin.net/?p=872 GNU TAR (Tape ARchive) combines multiple files together into a single tape or disk archive, and can restore individual files from the archive. Here are some Linux tar command with Useful practical examples. Some useful command line switches are given below, which are used in this article. -c => create a new archive file -v [...]

    The post Linux tar Command with Useful Practical Examples appeared first on TecAdmin.

    ]]>
    GNU TAR (Tape ARchive) combines multiple files together into a single tape or disk archive, and can restore individual files from the archive. Here are some Linux tar command with Useful practical examples.

    Some useful command line switches are given below, which are used in this article.

    • -c => create a new archive file
    • -v => show the detailed output (or progress) of command
    • -x => extract an archive file
    • -f => specify file name of an archive
    • -z => Use archive through gzip
    • -j => Use archive through bzip2
    • -J => Use archive through xz
    • -t => viewing content of archive
    • -O => Display file content on stdout
    • -r => append file to existing archive
    • -C => Use of define destination directory
    • -W => Verify a archive file

    How to Create Archive using Tar

    Use the following examples to create new archive file in different formats like .tar (a simple archive file), .tar.gz (gzip archive), .tar.bz2 (bzip2 archive file), and .tar.xz (xz archive file).

    1. Create .tar archive file – Compress all content of /var/www directory to a archive.tar file including all subdirectories.

    tar -cvf archive.tar /var/www
    

    2. Create .tar.gz archive file – Compress all content of /var/www directory to a archive.tar.gz file including all subdirectories. This will create higher compressed file that above.

    tar -zcvf archive.tar.gz /var/www
    

    3. Create .tar.bz2 archive file – Compress all content of /var/www directory to a archive.tar.bz2 file including all subdirectories. This takes more time to compress than others and provides the highest compressed file that above.

    tar -jcvf archive.tar.gz /var/www
    

    4. Create .tar.xz archive file – Compress all content of /var/www directory to a archive.tar.xz file including all subdirectories. This takes more time to compress than others and provides the highest compressed file that above.

    tar -Jcvf archive.tar.xz /var/www
    

    How to Extract Archive using Tar

    Use the following commands example to extract archive files. In this section each example has two commands, the First command will extract content in the current directory and the second command will extract file content in the specified directory with -C option.

    5. Extract .tar archive file –

    tar -xvf archive.tar
    tar -xvf archive.tar -C /tmp/
    

    6. Extract .tar.gz archive file –

    tar -zxvf archive.tar.gz
    tar -zxvf archive.tar.gz -C /tmp/
    

    7. Extract .tar.bz2 archive file –

    tar -jxvf archive.tar.bz2
    tar -jxvf archive.tar.bz2 -C /tmp/
    

    8. Extract .tar.xz archive file –

    tar -Jxvf archive.tar.xz
    tar -Jxvf archive.tar.xz -C /tmp/
    

    How to List Archive File Content with Tar

    You can list all the content inside a tar (Tape ARchive) file without extracting it. It helps the user to check available files in an archive and save users time.

    9. List .tar archive file content –

    tar -tvf archive.tar
    

    10. List .tar.gz archive file content-

    tar ztvf archive.tar.gz
    

    11. List .tar.bz2 archive file content-

    tar jtvf archive.tar.bz2
    

    12. List .tar.xz archive file content-

    tar Jtvf archive.tar.xz
    

    How to Update Tar Archive File

    You can use -u option to simply update archive file. Using this option, it will only append files newer than the copy in the archive file.

    13. Update .tar archive file –

    tar -uvf archive.tar /var/www
    

    14. Update .tar.gz archive file –

    tar -zuvf archive.tar.gz /var/www
    

    15. Update .tar.bz2 archive file –

    tar -juvf archive.tar.bz2 /var/www
    

    16. Update .tar.xz archive file –

    tar -Juvf archive.tar.xz /var/www
    

    Other Useful Archive File Commands

    Below are some more useful options available for handling tape archive files. Below examples are shown in the simple .tar file. You can use them with .tar.gz (-z option), .tar.bz2 (-j option) and .tar.xzf (-J option).

    17. Display file content – use -O followed by filename, this will display content of specified file.

    tar -uvf archive.tar -O backup/index.html
    

    18. Adding file to archive – use -r followed by filename to add more files to existing archive file.

    tar -rvf archive.tar add_new_file.txt
    

    Conclusion

    In this tutorial you have learned about Linux tar command with useful practical examples.

    For more details, visit: http://www.gnu.org/software/tar/manual/tar.html

    The post Linux tar Command with Useful Practical Examples appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/linux-tar-command-with-useful-practical-examples/feed/ 0