How to Extract a .gz File or directory in Linux using command prompt / terminal / shell / bash

Extract GZ archive file in Linux Terminal

To extract the GZ archive to the current directory, use below command.

$ gunzip archive.gz

.gz files are compressed with gzip compression algorithm. To extract .gz files we use gunzip command is used in Linux.

if the operation is successful, nothing is shown and linux command prompt is given back to the user

Extract GZ file and see verbose output

if you want to see what happens during the unzip operation , you can user the -v parameter with the command.

# gunzip -v file_name.gz

-v stands for verbose, which shows a log of actions happening while the archive is decompressed.

Also note, after decompressing using gubzip , the GZ extention is removed from the file. so , your compressed archive is no longer available but the extracted file.

Extract GZ file keep both orginal file and new

if you want to keep the archive as well, please use the -k parameter with the command as below.

# gunzip -k file_name.gz

View information about a GZ archive file

To view information about the compressive GZ gzip file, you can use the gunzip command like below, it does not uncompress the archive but give you vital information about the archive.

gunzip -l file_name.gz

Compress a file to a GZIP archive with GZ extension

Sometimes it is required to compress a file to save space, transfer safely or for other reasons. In Linux , you can use gzip command to compress a file. e.g.

gzip  file_name.txt

Compress a directory using gzip

On Linux, gzip is unable to compress a folder, it used to compress a single file only. To compress a folder, you should use tar + gzip, which is tar -z.

tar -zcvf outputFileName.tar.gz folderToCompress

Laravel Framework Cheat Sheet

Get laravel app base urbottom: 0px !important;border-top-width: 0px !important;

$app->make('url')->to('/');

$app['url']->to('/');

App::make('url')->to('/');

Laravel Scheduler – Cron Tutorial

Task scheduling is an important part of many web applications.

Here are several examples:

  • Check if new emails are received in a specified email accounts inbox, read them and take actions based on the information ( in every minute)
  • Perform batch jobs – etc dispatch order status change emails in an ecommerce system. (once a hour )
  • Clear logs ( once a day )

Laravel makes it super easy and intuitive to use linux CRON scheduler  to perform automated tasks for your web application.

Usually web applications achieve task scheduling by creating several cron jobs in Linux  that execute the required controller methods in the web application. Downside of this approach is that you need to create one cron job for each task.  So if there are 10 tasks , you have to create 10 cron jobs in Linux making it hard to manage.

Laravel adds a layer of programmable logic between the operating system and your web application that you can program your tasks with specified time interval to run them and use a single CRON job .

So once you create general cron job that invokes the laravel scheduler, you are free to programmatically add any number of tasks to run on various time intervals. There are many commonly used time intervals which can be accessed via easy to remember method names such as ->everyMinute(); which obviously runs a given task every minute.

TO be continued. Please provide your feedback below.