Linux Zip and Unzip Command with Examples

In this tutorial, we touch base on the zip and unzip commands and how they are used in Linux. Zip is a command used for creating an archive file or a zipped file. This allows you to compress your files and create more space for other files on your hard drive or removable drive. Additionally, zipping your files/directories makes them more portable and easier to upload, download or even attach and send them via email.The opposite of zipping is unzipping, and here we use the unzip command to decompress the files and access them individually.

Before start discussing zip and unzip command, let’s see how these commands can be installed from command line,

Install zip & unzip command on Ubuntu / Debian / Linux Mint

Open the terminal and run the following apt command,

$ sudo apt install -y zip unzip
$ sudo apt-get install -y zip unzip

Install zip & unzip command on CentOS / RHEL / Fedora

Open the terminal and execute the beneath command,

$ sudo yum install -y zip unzip
$ sudo dnf install -y zip unzip

Let’s dive in and see how to zip and unzip files and directories in Linux with zip and unzip command with examples.

Zip command in Linux

Zipping a file is as easy as ABC. The syntax is quite straightforward:

$ zip OPTIONS file

A few points to take into consideration before you proceed:

  • You need to have write permissions on the file you are zipping and the directory location before zipping a file.
  • When you unzip or extract a file, the user owns the file/directory.

Example 1) Zipping a single file and multiple files with zip command

Let’s assume you have a text file – reports1.txt – in your current directory and you want to zip it into an archive called

The command for this operation will be:

$ zip reports1.txt


Additionally, you can zip multiple files at a go into an archive as shown:

$ zip file1 file2 file3

Again, let’s assume that we have 3 text files reports1.txt, reports2.txt and reports3.txt. To zip them into the archive, run the command:

$ zip reports1.txt reports2.txt reports3.txt


Example 2) Adding a file to a zip archive (-u)

At times, you may find the need to add a file to a zip archive. To do so, use the -u flag. For example, to add another file reports4.txt, run:

$ zip -u report4.txt


Example 3) View contents of a zipped file

To view contents of a zipped file, use the command as shown:

$ zipinfo


Example 4) Zipping all the files in the current directory (* )

If you have multiple files in your current directory, you can zip all of them at a go using the wildcard symbol as shown in the syntax below:

$ zip *

For example, to compress all files in the home directory to archive, execute the command below. Be sure that you are working in the home directory.

$ zip *


Example 5) Delete a file from an archive (-d)

To remove a file from an archive, invoke the -d flag. For instance, to remove reports4.txt from the zipped …

Read More

Introduction to Web Hosting Bandwidth

One of the first things to do in the entire process of building a website is to purchase both a domain name and a hosting plan. The options for a domain name is pretty vast, as long as it has not been used or bought by someone else. When it comes to a hosting plan, […]


from ThisHosting.Rocks…

Read More

What Will the New Normal Be Like?

We are indeed living in some of the most interesting times. There have been some events in the history of the human race that has changed the way we live, that is true, but these happenings took years to effect drastic changes. Wars raged on for years before affecting the entire world, whole continents used to be spared from medical pandemics. Now, COVID-19 has affected each and single country directly or indirectly. In a matter of weeks, the way we lived has changed. What is exciting and a bit scary is that months from now when we will eventually come out of our lockdowns and quarantines, there is a huge possibility that there will be no going back from the way we live only months ago.

The new normal as pundits have coined the period pos-COVID-19, will indeed be new and will be markedly different from how we used to do things in February. The COVD-19 pandemic is one for the history books – so devastatingly major that we humans may already define our lives as everything that happened pre-COVID and months from now, post-COVID. This can be both good and bad. The environment’s condition has improved, we now have a deeper appreciation for personal relationships, health has become a priority. But then, freedoms we used to take for granted such as mobility and assembly have been curtailed. The new normal does have pros and cons to it.

Our current lockdown situations are serving as a dry run for the major effects the COVID-19 will eventually impose on our lives after its reign. The question is, are you ready for this “new normal”? Here are some changes you need to be aware of now:

Commerce and the nature of work

Not only has this pandemic changed the nature of business and work, it has forced some of its facets to mature. COVID-19 has created a survival of the fittest scenario among commercial and work practices, and what remains will not only survive, but will compose what will be the “new normal.” And we realize that some of our pre-COVID habits are actually impractical and don’t make sense, so that’s good. After all, there’s really no need to constantly use the ATM and get cash, drive to a store to buy things, and use your cash to pay for your purchases when you can have anything delivered to your house. Why waste an hour of two to commute to work when you can finish everything at home and even extend your work hours for an hour or two?

So, perhaps the conversation that we should be having as a society isn’t about where we are going to work after the post-covid dust settles, it should be how we are going to work.



Healthcare gets the spotlight

Even before COVID-19 started wreaking havoc, the health sector has already been subject to huge structural pressures and undergoing rapid advances in technology. For one, the global population, particularly in Europe and East Asia is ageing, posing a major challenge to governments in ramping up efforts for elderly care and geriatric medicine. COVID-19 has been overwhelming healthcare facilities anew, not to mention presenting a new race for experts to produce a …

Read More

How to Enforce Password Policies in Linux (Ubuntu / CentOS)

As much as Linux is considered a secure operating system, its security is just as good as the password strength of login users. Password policies exist to ensure that a strong password is set for users and as a Linux user, you should be mindful to enforce these policies to make it difficult for breaches to occur. You surely don’t want users configuring weak or guessable passwords which can be brute forced by hackers in a matter of seconds.

In this article, we touch base on how to enforce password policies in Linux, more specifically CentOS and Ubuntu. We will cover enforcing password policies such as password expiration period, password complexity and password length.

Enforce Password Policies in Ubuntu / Debian

There are 2 main ways that you can enforce password policies. Let’s take a look at each in detail.

1) Configure the maximum number of days that a password can be used

For start, you can configure a password policy that requires users to change their passwords after a certain number of days. Best practice dictates that a password should be changed periodically to keep malicious users off-kilter and make it harder for them to breach your system. This applies not just in Linux but in other systems such as Windows and macOS.

To achieve this In Debian/Ubuntu, you need to modify the /etc/login.defs file and be on the lookout for the PASS_MAX_DAYS attribute.

By default, this is set to 99,999 days as shown.


You can modify this to a reasonable duration, say, 30 days. Simply set the current value to 30 as shown and save the changes. Upon lapsing of the 30 days, you will be compelled to create another password.


2) Configure Password complexity with pam

Ensuring that password meets a certain degree of complexity is equally crucial and further thwarts any attempts by hackers to infiltrate your system using brute force.

As a general rule, a strong password should have a combination of Uppercase, lowercase, numeric and special characters and should be at least 12-15 characters long.

To enforce password complexity in Debian / Ubuntu systems, you need to install  the libpam-pwquality package as shown:

$ sudo apt install libpam-pwquality


Once installed, head out to the /etc/pam.d/common-password file from where you are going to set the password policies. Be default, the file appears as shown:


Locate the line shown below

password   requisite retry=3

Add the following attributes to the line:

minlen=12 maxrepeat=3 ucredit=-1 lcredit=-1 dcredit=-1 ocredit=-1 difok=4 reject_username enforce_for_root

The entire line should appear as shown:


Let’s flesh out what these directives stand for:

  • retry=3: This option will prompt the user 3 times before exiting and returning an error.
  • minlen=12: This specifies that the password cannot be less than 12 characters.
  • maxrepeat=3: This allows implies that only a maximum of 3 repeated characters can be included in the password.
  • ucredit=-1: The option requires at least one uppercase character in the password.
  • lcredit=-1: The option requires at least one lowercase character in the password.
  • dcredit=-1: This implies that the password should have at last a numeric character.
  • ocredit=-1: The option requires at least one special character included in the password.
  • difok=3: This implies that only a  maximum of
Read More

How to Access Google Drive on Ubuntu 20.04 (Focal Fossa)

Google Drive is a cloud storage option that provides an excellent backup solution for all your files and folders. We cannot emphasize enough the importance of having backup copies of your files. Anything can happen at any time and when it does, you want to ensure that you are on the safe side and can log in to Google Drive and recover your lost documents.

That said, Having Google Drive sync capability on your Linux PC is of utmost importance. With Google Drive, you will get free 15GB to get you started and thereafter, you will pay according to the amount of space you need to secure your files. In this guide, you will learn different ways that you can use to access Google Drive on your Ubuntu 20.04 LTS Desktop (Focal Fossa).

Mount / Access Google Drive using the Online accounts feature

This is by far the easiest way of accessing Google Drive on your system. To start off, search for the ‘Online accounts’ option in the application menu as shown. Then click on the ‘Online Accounts’ option as shown.


This ushers you to the ‘Online Accounts’ section displaying various options that you can access and connect with. Since we are interested in accessing Google Drive, we will click on the ‘Google’ option as shown:


Next, you will be required to sign into your Google Account, Firstly, provide your Gmail email address.


Press the ‘ENTER’ button to proceed to the next step where you will be required to provide your password:


Then press the ‘ENTER’ button. If you have secured your Google Account with a 2-step verification method, you will be required to act accordingly to access your account.


Next, GNOME will request your permission to access your Google Account and gain access to your Gmail account, Google Drive among other things as shown.


Scroll down and click ‘Allow


In the next step, you can choose to select the features that you’d want to sync between your PC and your Google account. In this case, I have opted to turn on all the settings.


At this point, your Google account will be attached or associated with this PC. To access your Google Drive directory, head out to the file manager as shown.


In the ‘Files’ window, scroll down and double-click on the Google Drive icon as shown below to mount the Google Drive folder and access your files and folders.


From there, you can copy and paste files to the mounted Google Drive folder and sync with your online Google Drive account. Just place a file on the mounted folder and head over to Google Drive and confirm if it exists.

Access Google Drive using Insyc

Insync is a cross-platform client that allows you to access and manage your Google Drive and OneDrive files and folders straight from your PC. It’s free for 14 days upon which you will be required to pay according to your preferred subscription.

To get started, head out to Insync downloads page


Select to download the Linux Debian package that corresponds to Ubuntu 20.04.


Once you have downloaded the Debian package, install Insync by executing the command …

Read More

SShield Review – AI-Powered Automated Security Tool

We’ll be reviewing SShield, which is a part of SPanel. After the great interest of our SPanel review, it’s a great idea to focus on individual parts of SPanel itself, like SShield. Read our detailed review below. What is SShield SShield is a security tool that monitors all your website in real-time, 24/7. The tool […]


from ThisHosting.Rocks…

Read More

Make Yourself In-Demand in a Post-COVID World With These Skills

If the death toll of the ongoing COVID-19 pandemic is not giving you serious bouts of depression, here’s something scarier: For the past month, 10% of the US workforce, or close to 15 million people do not have jobs anymore, also thanks to the pandemic. As of the end of April, over 26 million people have looked into unemployment benefits, and the figure is not showing any signs of decline. This is millions of us who are struggling on multiple fronts: how to stay healthy, how to pay the bills, and how to keep sane with everything that’s going on.

With the job market at its rockiest in history, laid-off employees may want to use this lockdown period as an opportunity to reassess themselves in terms of their careers, what they really want to do as work, what their skills are, what the job market needs, and what skills they can develop to make themselves more “marketable” when the “new normal” kicks in.

The same goes for you, still working reader. You may be “secure” in your current job, but with the way the world economy is going, no one is dispensable. The business and commercial landscape is evolving, all the more because of the COVID-19 crisis. Demands from companies are changing, and if you plan to stick around in the employed sector of the economy, you need to keep your skillset updated to these demands. It doesn’t matter if you are “not so technical” and past your prime; if you want to stay employed, you have to reskill, upskill, and get your available skills in line with what the market needs.  What skills are these? Take note of these skills that you need to acquire as soon as possible:


Up your critical thinking and problem-solving skills

According to a Society for Human Resource Management survey, the top soft skill that is absent among candidates according to 37% of employers is critical thinking and problem solving. The chance of someone with demonstrated problem solving and critical thinking skills getting hired is very high, as they are valued for providing options and solutions when companies face problems such as the current one everyone is facing.

Employers say they need a workforce fully equipped with skills beyond the basics of reading, writing, and arithmetic to grow their businesses. These skills include critical thinking and problem solving, according to a 2010 Critical Skills Survey by the American Management Association and others.



Up your social media and digital marketing skills

With the current lockdown forcing businesses to shift to methods that do not require physical contact and the near future most probably seen to continue with this, efforts to encourage consumers to buy things have also shifted to online and digital.  Thus, in-demand skills involve search engine marketing (marketing that will allow your business to shine in Google and other search engines), search engine optimization (marketing that will allow your online assets (website, social media) to be optimized so that your business will rank high on search engines), and email marketing.

While certain industries like Travel and Hospitality and Retail were hit very hard and it felt like they may take a while to restart, many other industries it

Read More

How to Install and Configure Checkmk on CentOS 8 / RHEL 8

Developed in Python & C++ languages, Checkmk is an open-source monitoring server that is an improvement of Nagios operating system with enhanced plugins and monitoring capabilities. Checkmk uses agents to collect and ship remote systems’ metrics to the server. The agents are available for both Linux and Windows systems in 32 & 64-bit architectures.

Checkmk is used in monitoring applications, servers and even cloud infrastructure such as AWS and Azure. In this guide, we will walk you through how to install and configure Checkmk on CentOS 8 and later on, see how you can add both Linux and Windows hosts to checkmk server for monitoring.

We will install Checkmk using the OMD (Open Monitoring Distribution) bundle. This bundle ships with Nagios and all the necessary plugins required for monitoring various services.

Lab Setup details for Checkmk

This will be our set up

  • Checkmk Server – CentOS 8
  • Host 1 – CentOS  8
  • Host 2 – Windows Server 2019

Step 1) Update the system

To start off, it’s always advisable to update your package lists to start on a clean slate. Therefore, log in to the Checkmk server and run the off command below.

$ sudo dnf update -y

Once the update is completed successfully and reboot the system once.

Step 2) Install prerequisite packages

Once the update is complete, you need to install a couple of packages for the installation of Checkmk monitoring tool to go smoothly.

First, you need to install EPEL. This is short for Extra Packages for Enterprise Linux. This is a package repository that provides additional packages that are not present in the default AppStream repositories for CentOS 8. This will prove beneficial as some of the packages required by OMD are contained in EPEL.

To install the EPEL repository, execute the command:

$ sudo dnf install epel-release


Press ‘y’ on the keyboard and hit ENTER to proceed with the installation.

Next, ensure that you install xinetd and OpenSSL packages. Therefore, run the command:

$ sudo dnf install xinetd openssl -y

Also, ensure that Python 3 is installed (It comes preinstalled by default on CentOS 8). In case it is not installed on your CentOS 8 / RHEL 8 system then run following command to install it,

$ sudo dnf install python3 -y

Run following command to verify the python version

[[email protected] ~]$ python3 -V
Python 3.6.8
[[email protected] ~]$

Don not forget to install ‘graphiz-gd’ package from PowerTools repository, run the following dnf command

$ sudo dnf --enablerepo=PowerTools install graphviz-gd -y

Step 3) Set SELinux and firewall rules for checkmk

SELinux is a kernel security module that enhances the security of your CentOS 8 and RHEL 8 system. Set the following selinux rule to allow web server to access network interfaces,

$ sudo setsebool -P httpd_can_network_connect 1

Now allow http service or its port in firewall, run

$ sudo firewall-cmd --zone=public --add-service=http --permanent
$ sudo firewall-cmd --reload

Note: You can skip this only if Selinux and firewalld is disabled on your system.

Step 4) Installing Checkmk monitoring tool

With all the prerequisites out of the way, it’s time now to install Checkmk First, download the RPM package from the Official site.

$ wget


Once downloaded install Checkmk rpm package with …

Read More

Top 7 Security Hardening Tips for CentOS 8 / RHEL 8 Server

Once you have installed your CentOS 8 / RHEL 8 server, securing it to prevent unauthorized access and intrusions comes second. As the adage goes , “Prevention is better than cure” so is prevention of hacks better that taking remediation attempts.

Let explore a few steps that you can take to harden and secure CentOS 8 / RHEL 8 server and thwart hacking attempts.

1) Set up a firewall

As a security-minded Linux user, you wouldn’t just allow any traffic into your CentOS 8 / RHEL 8 system for security reasons. In fact, setting up a firewall is one of the initial server setup tasks that a systems administrator needs to perform to only open specific ports and allow services currently in use.

By default, CentsO8 / RHEL 8 system ship with firewalld firewall which can be started and enabled on startup by running the commands:

$ sudo systemctl start firewalld
$ sudo systemctl enable firewalld

To check the services allowed on the firewall, simply run the command:

$ sudo firewall-cmd --list all

To open a port on the firewall e.g port 443, execute the command:

$ sudo firewall-cmd --add-port=443/tcp --zone=public --permanent

To allow a service e.g ssh , use the command:

$ sudo firewall-cmd --add-service=ssh  --zone=public --permanent

To remove a port and a service , use the –remove-port  and –remove-service attributes respectively.

For the changes to take effect , always reload the firewall as shown.

$ sudo firewall-cmd --reload

2) Disable unused / undesirable services

It’s always advised to turn off unused or unnecessary services on your server. This is because the higher the number of services running, the more the number of ports open on your system which can be exploited by an attacker to gain entry to your system. Additionally, desist from using old and insecure service like telnet which send traffic in plain text

Best security practices recommend disabling unused services and getting rid of all the insecure services running on your system. You can use the nmap tool to scan your system and check which ports are open and being listened to.

3) Secure critical files

It’s essential to lock down critical files to prevent accidental deletion or editing. Such files include the /etc/passwd and /etc/gshadow which contain hashed passwords. To make the files immutable ( i.e prevent modification or accidental deletion ) use the chattr command as shown:

$ sudo chattr +i /etc/passwd
$ sudo chattr +i /etc/shadow

This ensures that a hacker cannot change any of the users’ password or delete them leading to denial of login to the system.

4) Secure SSH protocol

SSH protocol is a popularly used protocol for remote logins. By default , the protocol has native weaknesses that can be exploited by a hacker.

By default, SSH allows remote login by the root user. This is a potential loophole and if a hacker can get a hold of the root’s password to your system, your server is pretty much at their mercy. To prevent this, it’s advisable to deny remote root login and instead create a login regular user with sudo privileges. You can effect this  by modifying the SSH configuration file /etc/ssh/sshd_config and disable root login as shown:


Another way you can secure SSH is …

Read More

Self-Hosted and Open-Source Alternatives to Popular Services

The internet is a prominent place. And while it may feel like a few huge names like Netflix, Dropbox, and Facebook run the show, they are far from the only option you have available. It’s now easier than ever to find a self-hosted alternative to just about any online platform. What does self-hosted mean? Self-hosted […]


from ThisHosting.Rocks…

Read More