January 2023

Archive page for January 2023 by Linux Bash
  • Posted on

    Linux is an open-source Operating System which is released with different flavours (or distros) under the guise of free-to-use software. Anybody can download and run Linux free-of-charge and with no restraints on the end-user; you could release, distribute and profit from Linux with relative ease with no worry of associated cost or licensing infringement.

    It is fair to say Linux has formidably and profoundly revolutionised and defined the process of interacting with electronic devices. You can find Linux in cars, refrigerators, televisions and of course, as a desktop-grade or headless operating system. Once you become accustomed to Linux, you quickly see just why all the top 500 supercomputers all run Linux.

    Linux has been around since the mid-1990’s and is is one of the most reliable, secure and hassle-free operating systems available. Put simply, Linux has become the largest open sources software project in the world. Professional and hobbyist programmers and developers from around the world contribute to the Linux kernel, adding features, finding and fixing bugs and security flaws, live patching and providing new ideas—all while sharing their contributions back to the community.

    Wikipedia

    Linux is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds.

    Direct Link to Linux on Wikipedia

    Open Source

    Linux is a free, open source operating system, released under the GNU General Public License (GPL). Anyone can run, study, modify, and redistribute the source code, or even sell copies of their modified code, as long as they do so under the same license.

    Command Line

    The command line is your direct access to a computer. It's where you ask software to perform hardware actions that point-and-click graphical user interfaces (GUIs) simply can't ask.

    Command lines are available on many operating systems—proprietary or open source. But it’s usually associated with Linux, because both command lines and open source software, together, give users unrestricted access to their computer.

    Installing Linux

    For many people, the idea of installing an operating system might seem like a very daunting task. Believe it or not, Linux offers one of the easiest installations of all operating systems. In fact, most versions of Linux offer what is called a Live distribution, which means you run the operating system from either a CD/DVD or USB flash drive without making any changes to your hard drive. You get the full functionality without having to commit to the installation. Once you’ve tried it out, and decided you wanted to use it, you simply double-click the “Install” icon and walk through the simple installation wizard.

    Installing Software on Linux

    Just as the operating system itself is easy to install, so too are applications. Most modern Linux distributions include what most would consider an app store. This is a centralized location where software can be searched and installed. Ubuntu Linux (and many other distributions) rely on GNOME Software, Elementary OS has the AppCenter, Deepin has the Deepin Software Center, openSUSE has their AppStore, and some distributions rely on Synaptic.

    Regardless of the name, each of these tools do the same thing: a central place to search for and install Linux software. Of course, these pieces of software depend upon the presence of a GUI. For GUI-less servers, you will have to depend upon the command-line interface for installation.

    Let’s look at two different tools to illustrate how easy even the command line installation can be. Our examples are for Debian-based distributions and Fedora-based distributions. The Debian-based distros will use the apt-get tool for installing software and Fedora-based distros will require the use of the yum tool. Both work very similarly. We’ll illustrate using the apt-get command. Let’s say you want to install the wget tool (which is a handy tool used to download files from the command line). To install this using apt-get, the command would like like this:

    sudo apt-get install wget
    

    The sudo command is added because you need super user privileges in order to install software. Similarly, to install the same software on a Fedora-based distribution, you would first su to the super user (literally issue the command su and enter the root password), and issue this command:

    yum install wget
    

    That’s all there is to installing software on a Linux machine. It’s not nearly as challenging as you might think. Still in doubt?

    You can install a complete LAMP (Linux Apache MySQL PHP) server on either a server or desktop distribution. It really is that easy.

    More resources

    If you’re looking for one of the most reliable, secure, and dependable platforms for both the desktop and the server, look no further than one of the many Linux distributions. With Linux you can assure your desktops will be free of trouble, your servers up, and your support requests minimal.

  • Posted on

    If you’ve ever used a Linux operating system used on most Virtual Private Servers, you may have heard of bash. It’s a Unix shell that reads and executes various commands.

    What Is Bash?

    Bash, short for Bourne-Again Shell, is a Unix shell and a command language interpreter. It reads shell commands and interacts with the operating system to execute them.

    Why Use Bash Scripts?

    Bash scripts can help with your workflow as they compile many lengthy commands into a single executable script file. For example, if you have multiple commands that you have to run at a specific time interval, you can compile a bash script instead of typing out the commands manually one by one. You then execute the script directly, when it’s necessary.

    Pro Tip Linux has a bash shell command manual. Type man command to find descriptions of all the technical terms and input parameters.

    Get Familiar With Bash Commands

    Bash is available on almost all types of Unix-based operating systems and doesn’t require a separate installation. You will need a Linux command prompt, also known as the Linux terminal. On Windows you would use something like PuTTy. It’s a program that contains the shell and lets you execute bash scripts. 

    1. Comments

    Comments feature a description on certain lines of your script. The terminal doesn’t parse comments during execution, so they won’t affect the output.

    There are two ways to add comments to a script. The first method is by typing # at the beginning of a single-line comment. # Command below prints a Hello World text echo “Hello, world!”

    2. Variables

    Variables are symbols that represent a character, strings of characters, or numbers. You only need to type the variable name in a command line to use the defined strings or numbers.

    To assign a variable, type the variable name and the string value like here: testvar=“This is a test variable”

    In this case, testvar is the variable name and This is a test variable is the string value. When assigning a variable, we recommend using a variable name that’s easy to remember and represents its value.

    To read the variable value in the command line, use the $ symbol before the variable name. Take a look at the example below:

    testvar=“This is a test variable”
    echo $testvar
    

    In order to let the user enter the variable contents use:

    read testvar
    echo $testvar
    

    3. Functions

    A function compiles a set of commands into a group. If you need to execute the command again, simply write the function instead of the whole set of commands.

    There are several ways of writing functions. The first way is by starting with the function name and following it with parentheses and brackets:

    function_name () {
        first command
        second command
    }
    

    Or, if you want to write it in a single line: function_name () { first command; second command; }

    4. Loops

    Loop bash commands are useful if you want to execute commands multiple times. There are three types of them you can run in bash – for, while, and until. The for loop runs the command for a list of items:

    for item in [list]
    do
        commands
    done
    

    The following example uses a for loop to print all the days of the week:

    for days in Monday Tuesday Wednesday Thursday Friday Saturday Sunday
    do
        echo “Day: $days”
    done
    

    On line 2, “days” automatically becomes a variable, with the values being the day names that follow. Then, in the echo command, we use the $ symbol to call the variable values.

    The output of that script will be as follows:

    Day: Monday
    Day: Tuesday
    Day: Wednesday
    Day: Thursday
    Day: Friday
    Day: Saturday
    Day: Sunday
    

    Notice that even with just one command line in the loop script, it prints out seven echo outputs.

    The next type of loop is while. The script will evaluate a condition. If the condition is true, it will keep executing the commands until the output no longer meets the defined condition.

    while [condition]
        do
    commands
    done
    

    5. Conditional Statements

    Many programming languages, including bash, use conditional statements like if, then, and else for decision-making. They execute commands and print out outputs depending on the conditions. The if statement is followed by a conditional expression. After that, it’s followed by then and the command to define the output of the condition. The script will execute the command if the condition expressed in the if statement is true.

    However, if you want to execute a different command if the condition is false, add an else statement to the script and follow it with the command.

    Let’s take a look at simple if, then, and else statements. Before the statement, we will include a variable so the user can input a value:

    echo “Enter a number”
    read num
    if [[$num -gt 10]]
    then
    echo “The number is greater than 10”
    else
    echo “The number is not greater than 10”
    

    OK, so that's it. The 5 building blocks of Bash in plain English. Simple, right?!

  • Posted on

    1) Ubuntu

    Ubuntu Logo

    – Ubuntu is by far the most popular Linux distribution with an intuitive GUI (Graphical User Interface) that is easy to learn and very familiar for Windows users.

    – It is essentially Debian-based and easy to install with top-notch commercial support although this is largely irrelevant if you can point and click with a basic understanding of how to interact with applications as you do in Windows.

    – Most preferred Linux distribution for non-tech people.

    Ubuntu Project Home Page

    2) CloudLinux

    CloudLinux – CloudLinux is on a mission to make Linux secure, stable, and profitable.

    – Based solely on the same platform as Red Hat Enterprise Linux for stable releases and usually command prompt based servers.

    – License fees are reasonable for small businesses so it is still a go-to option in the Linux flavour world.

    CloudLinux Project Home Page

    3) Red Hat Enterprise Linux (a.k.a. RHEL)

    Red Hat Enterprise Linux (RHEL) Logo

    – Another most famous and open-source Linux Distribution is Red Hat Enterprise Linux (RHEL). It is a stable, secure yet powerful software suited mostly to the server classification; however it does provide a wealth of tools, apps and other front end software, if not run headless.

    – RHEL was devised by Red Hat for commercial purposes. It offers tremendous support for Cloud, Big Data, IoT, Virtualization, and Containers.

    – Its components are based on Fedora, a community-driven project.

    – RHEL supports 64-bit ARM, Power, and IBM System z machines.

    – The subscription of Red Hat allows the user to receive the latest enterprise-ready software, knowledge base, product security, and technical support.

    Red Hat Enterprise Linux

    4) AlmaLinux

    AlmaLinux

    – Stable and open-source derivative of Red Hat Enterprise Linux, an easy way to run the commercial product in open-source format.

    – A popular free Linux distros for VPS and operationally compatible with RHEL.

    – AlmaLinux is a open-source distribution owned and governed by the community. As such, they are free and focused on the community's needs and long-term stability. Both Operating Systems have a growing community with an increasing number of partners and sponsors.

    – Considered the go-to Operating System of choice since CentOS announced the end-of-life for CentOS 8, in favour of being an upstream provider to RHEL (releasing software before RHEL)

    AlmaLinux Project Home Page

    5) Rocky Linux

    Rocky Linux Logo

    – Similar to AlmaLinux, this OS is a stable and open-source derivative of Red Hat Enterprise Linux. Use open-source instead of paying license fees.

    – A popular free Linux distros for VPS and operationally compatible with RHEL.

    – Rocky Linux is of course open-source and while they don't have the backing financially like AlmaLinux, it's still a worthy community contributed effort.

    Rocky Linux Project Home Page

    6) SUSE

    SUSE Logo

    – The subsequent widespread distribution is SLES which is based on OpenSUSE.

    – Both OpenSUSE & SUSE Linux Enterprise Server have the same parent company – SUSE.

    – SUSE is a german-based open-source software company.

    – The commercial product of SUSE is SLED and OpenSUSE is the non-commercial distro.

    SUSE Project Home Page

    7) Debian

    Debain Logo

    – It is open-source and considered a stable Linux distribution.

    – Ships in with over 51000 packages and uses a unified packaging system.

    – Used by every domain, including Educational Institutions, Companies, Non-profit, and Government organizations.

    – Supports more significant of computer architectures. It includes 64-bit ARM (Aarch64), IBM System z, 32-bit PC (i386), 64-bit PC (amd64), and many more.

    – At last, it is integrated with a bug tracking system. By reading its documentation and content available for web related to Debian helps you in its support.

    Debain Project Home Page


    Welcome to the world of open-source distros relevant today. It is all about the 7 best Linux Distros for VPS Hosting of 2023. Let us know which distribution you or your company using today. If you plan to purchase the Linux VPS Server and are confused between the Linux Distros, connect via the comments or lookup more content on here for some easy learning.