Wednesday, 12 December 2018

How To: Install or Upgrade to Linux Kernel 4.19 in Ubuntu/Linux Mint

The Linux Kernel 4.19 is available for the users. This Linux Kernel version comes with plenty of fixes and improvements. This article will guide you to install or upgrade to Linux Kernel 4.19 in your Ubuntu or Linux Mint system.


Installation

For 32-Bit Systems

Download the .deb packages.

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-headers-4.19.0-041900_4.19.0-041900.201810221809_all.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-headers-4.19.0-041900-generic_4.19.0-041900.201810221809_i386.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-image-4.19.0-041900-generic_4.19.0-041900.201810221809_i386.deb

Install them.

$ sudo dpkg -i linux-headers-4.19.0*.deb linux-image-4.19.0*.deb

Reboot the system.

$ sudo reboot





For 64-Bit Systems

Download the .deb packages.

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-headers-4.19.0-041900_4.19.0-041900.201810221809_all.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-headers-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-image-unsigned-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb

Install them.

$ sudo dpkg -i linux-headers-4.19.0*.deb linux-image-4.19.0*.deb

Reboot the system.

$ sudo reboot

To uninstall,

$ sudo apt-get remove 'linux-headers-4.19.0*' 'linux-image-4.19.0*'

This article is sponsored by Betterhelp!

Functions in Shell Scripting

Functions in Shell Scripting - We have been learning Shell/Bash scripting and so far we have covered control flow (if-elif-else and case) statements and loops (for loop, while loop and select loop). This article is all about another important and widely used aspect of programming, called Functions.


A function is a block of code which has a name and performs a certain task. We can reuse this block of code by invoking it using the assigned name. Functions do not only improve readability of the program, but also reduce the redundancy in the code.

Defining a function

Its very easy to create a simple function. As said earlier, a function is a name given to a block of code and we enclose this block of code (or function body) between a pair of parenthesis. The basic syntax to create a function is as below:

Syntax:

myFunction() {
     ...
     ...
}

Or we can use a keyword function to define a function named myFunction as shown below:

function myFunction {
    ...
    ...
}

Lets take an example of a function named sayHello that just has - echo "Hello world!" in the function body.

sayHello() {
    echo "Hello world!"
}

OR

function sayHello {
    echo "Hello world!"
}

Yay! You just created your first function. You can put any working code in the function body and give any meaningful name to your function.

Function call

Calling a function or simply a function call, is nothing but making use of the function you already created. To call a function, you must define a function. If you don't define a function, program will fail to execute giving our error. So, lets just call the function we just created - sayHello.

$ sayHello() {
>     echo 'Hello world!'
> }

$ sayHello
Hello world!

Awesome! We just executed a block of code using a simple name! The story doesn't end here. We can provide data to the function, so that it can process the data by executing block of code on it and give us the output. Lets check this in more details.

Passing arguments to a function

In our article on Environment variables and special shell variables, we studied about positional arguments to the script. The case is exactly same here. We can make a function call, provide arguments to it and access those arguments using shell variables $1, $2, $3 and so on. In this case, $1 is the first argument to the function, $2 is the second argument the function and so on. Lets check how it works.

$ sayHello() {
>     NAME=$1
>     echo "Hello, $NAME"
> }

$ sayHello Dexter
Hello, Dexter

$ sayHello Debra
Hello, Debra

Here, we have made two calls to the function sayHello with two different arguments Dexter and Debra. Each time a function call is made, NAME=$1 stores the first argument to the function (Dexter and Debra in two different function calls) to variable defined as NAME. Once it is stored, we can use this variable as many times as we wish to.

Lets take another example. We create a function magicString wherein it takes an alphanumeric string as an argument and tells you how many alphabets and numerics the string has.

$ magicString() {
 STRING=$1
 ALPHA=`echo $STRING | tr -d '[0-9]' | wc -c`
 NUM=`echo $STRING | tr -d '[a-zA-Z]' | wc -c`
 echo "Alphabets = $ALPHA; Numerics = $NUM"
}

When we call this function with an alphanumeric string as an argument, lets see what the output looks like:

$ magicString su9Lei6aQuoh3gik
Alphabets =       13; Numerics =        3

$ magicString Phe8aebe1uf69ac0
Alphabets =       11; Numerics =        5

Thats it for the scope of this article. Stay tuned for more interesting ones.

This article is sponsored by Betterhelp!

Sunday, 9 December 2018

How To: Install or Upgrade to Linux Kernel 4.18 in Ubuntu/Linux Mint

The Linux Kernel 4.18 is available for the users. This Linux Kernel version comes with plenty of fixes and improvements. This article will guide you to install or upgrade to Linux Kernel 4.18 in your Ubuntu or Linux Mint system.


Installation

For 32-Bit Systems

Download the .deb packages.

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.18/linux-headers-4.18.0-041800_4.18.0-041800.201808122131_all.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.18/linux-headers-4.18.0-041800-generic_4.18.0-041800.201808122131_i386.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.18/linux-image-4.18.0-041800-generic_4.18.0-041800.201808122131_i386.deb

Install them.

$ sudo dpkg -i linux-headers-4.18.0*.deb linux-image-4.18.0*.deb

Reboot the system.

$ sudo reboot





For 64-Bit Systems

Download the .deb packages.

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.18/linux-headers-4.18.0-041800_4.18.0-041800.201808122131_all.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.18/linux-headers-4.18.0-041800-generic_4.18.0-041800.201808122131_amd64.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.18/linux-image-unsigned-4.18.0-041800-generic_4.18.0-041800.201808122131_amd64.deb

Install them.

$ sudo dpkg -i linux-headers-4.18.0*.deb linux-image-4.18.0*.deb

Reboot the system.

$ sudo reboot

To uninstall,

$ sudo apt-get remove 'linux-headers-4.18.0*' 'linux-image-4.18.0*'

How To: Install or Upgrade to Linux Kernel 4.17 in Ubuntu/Linux Mint

The Linux Kernel 4.17 is available for the users. This Linux Kernel version comes with plenty of fixes and improvements. This article will guide you to install or upgrade to Linux Kernel 4.17 in your Ubuntu or Linux Mint system.



Installation

For 32-Bit Systems

Download the .deb packages.

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17/linux-headers-4.17.0-041700_4.17.0-041700.201806041953_all.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17/linux-headers-4.17.0-041700-generic_4.17.0-041700.201806041953_i386.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17/linux-image-4.17.0-041700-generic_4.17.0-041700.201806041953_i386.deb

Install them.

$ sudo dpkg -i linux-headers-4.17.0*.deb linux-image-4.17.0*.deb

Reboot the system.

$ sudo reboot





For 64-Bit Systems

Download the .deb packages.

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17/linux-headers-4.17.0-041700_4.17.0-041700.201806041953_all.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17/linux-headers-4.17.0-041700-generic_4.17.0-041700.201806041953_amd64.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17/linux-image-unsigned-4.17.0-041700-generic_4.17.0-041700.201806041953_amd64.deb

Install them.

$ sudo dpkg -i linux-headers-4.17.0*.deb linux-image-4.17.0*.deb

Reboot the system.

$ sudo reboot

To uninstall,

$ sudo apt-get remove 'linux-headers-4.17.0*' 'linux-image-4.17.0*'

How To: Install or Upgrade to Linux Kernel 4.16 in Ubuntu/Linux Mint

The Linux Kernel 4.16 is available for the users. This Linux Kernel version comes with plenty of fixes and improvements. This article will guide you to install or upgrade to Linux Kernel 4.16 in your Ubuntu or Linux Mint system.



Installation

For 32-Bit Systems

Download the .deb packages.

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.16/linux-headers-4.16.0-041600_4.16.0-041600.201804012230_all.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.16/linux-headers-4.16.0-041600-generic_4.16.0-041600.201804012230_i386.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.16/linux-image-4.16.0-041600-generic_4.16.0-041600.201804012230_i386.deb

Install them.

$ sudo dpkg -i linux-headers-4.16.0*.deb linux-image-4.16.0*.deb

Reboot the system.

$ sudo reboot





For 64-Bit Systems

Download the .deb packages.

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.16/linux-headers-4.16.0-041600_4.16.0-041600.201804012230_all.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.16/linux-headers-4.16.0-041600-generic_4.16.0-041600.201804012230_amd64.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.16/linux-image-4.16.0-041600-generic_4.16.0-041600.201804012230_amd64.deb

Install them.

$ sudo dpkg -i linux-headers-4.16.0*.deb linux-image-4.16.0*.deb

Reboot the system.

$ sudo reboot

To uninstall,

$ sudo apt-get remove 'linux-headers-4.16.0*' 'linux-image-4.16.0*'

Saturday, 8 December 2018

How To: Install or Upgrade to Linux Kernel 4.15 in Ubuntu/Linux Mint

The Linux Kernel 4.15 is available for the users. This Linux Kernel version comes with plenty of fixes and improvements. This article will guide you to install or upgrade to Linux Kernel 4.15 in your Ubuntu or Linux Mint system.


Installation

For 32-Bit Systems

Download the .deb packages.

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-headers-4.15.0-041500_4.15.0-041500.201802011154_all.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-headers-4.15.0-041500-generic_4.15.0-041500.201802011154_i386.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-image-4.15.0-041500-generic_4.15.0-041500.201802011154_i386.deb

Install them.

$ sudo dpkg -i linux-headers-4.15.0*.deb linux-image-4.15.0*.deb

Reboot the system.

$ sudo reboot





For 64-Bit Systems

Download the .deb packages.

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-headers-4.15.0-041500_4.15.0-041500.201802011154_all.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-headers-4.15.0-041500-generic_4.15.0-041500.201802011154_amd64.deb

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-image-4.15.0-041500-generic_4.15.0-041500.201802011154_amd64.deb

Install them.

$ sudo dpkg -i linux-headers-4.15.0*.deb linux-image-4.15.0*.deb

Reboot the system.

$ sudo reboot

To uninstall,

$ sudo apt-get remove 'linux-headers-4.15.0*' 'linux-image-4.15.0*'