Install JDK9 on Linux Mint

In this article we will see how we can install JDK9 i.e. Oracle Java 9 on Linux mint version.

Execute the below commands in sequence on Linux Mint machine:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java9-installer

While executing the above you will see the get the aggrement options where we need to click ok and proceed. After the above steps setup Java environment using PPA repository

Exeucte the below command to install the package :

sudo apt-get install oracle-java9-set-default

Now let us check our Java version by exeucting the below commands:

oracle@dev-VirtualBox ~ $ java -version
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
oracle@dev-VirtualBox ~ $ 

Thank you for reading my blog , please feel free to leave me some feedback or to suggest any future topics.

Looking forward to hear from you – Swadhin Ray (Sloba) -( LinkedIn ) ( Twitter )



0% [Connecting to ] Error

I encountered this error while using “apt-get” command on  my Linux mint server and it got stuck for 12-3 mins.

Here is the details on my error that I faced :

dev@dev-VirtualBox /etc $ sudo apt-get install alien
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
autoconf automake autopoint autotools-dev debhelper debugedit dh-autoreconf
dh-strip-nondeterminism libfile-stripnondeterminism-perl librpm3
librpmbuild3 librpmio3 librpmsign3 libtool po-debconf rpm rpm-common




0% [Connecting to (2001:67c:1560:8001::14)] [Connecting to

The issue is on the IPv6 taking more time to execute. Now let us check if my IPv6 is enabled or disabled. Based on the output we will see if we need to disable.

dev@dev-VirtualBox /etc $ cat /proc/sys/net/ipv6/conf/all/disable_ipv6
dev@dev-VirtualBox /etc $

If we get the output “0” then my IPv6 is enabled and if we get “1” then it is disabled.  So in my case I have to disable it. Let us see how we can disable it . And try to rerun my command where I got stuck.

To disable please execute the below commands and after that reboot the machine:

dev@dev-VirtualBox /etc $ echo "#disable ipv6" | sudo tee -a /etc/sysctl.conf
#disable ipv6
dev@dev-VirtualBox /etc $ echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
dev@dev-VirtualBox /etc $ echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
net.ipv6.conf.default.disable_ipv6 = 1
dev@dev-VirtualBox /etc $ echo "net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
net.ipv6.conf.lo.disable_ipv6 = 1
dev@dev-VirtualBox /etc $

I have rebooted my system now let us check what is the output I am getting :

oracle@dev-VirtualBox ~ $ cat /proc/sys/net/ipv6/conf/all/disable_ipv6
oracle@dev-VirtualBox ~ $

Now we can see that my IPv6 is disabled , so let us try to execute my initial “apt-get” command

dev@dev-VirtualBox ~ $ sudo apt-get update
Hit:1 xenial InRelease
Ign:2 sylvia InRelease
Hit:3 sylvia Release
Hit:4 xenial InRelea




Get:22 xenial-updates/universe Translation-en [233 kB]
Get:23 xenial-updates/multiverse amd64 Packages [16.2 kB]
Get:24 xenial-updates/multiverse i386 Packages [15.3 kB]
Fetched 4,825 kB in 1s (2,621 kB/s)
Reading package lists... Done
dev@dev-VirtualBox ~ $

So we can see that we are now able to install the packages without any issues.


Thank you for reading my blog , please feel free to leave me some feedback or to suggest any future topics.

Looking forward to hear from you – Swadhin Ray (Sloba) -( LinkedIn ) ( Twitter )



Append row into a CSV file on SFTP

In this post I am going to show how we can append a row into CSV file using simple bash command.

To demonstrate this I am using Linux virtual machine, the OS is on Mint 18.3 64bit.  First me create a sample file on my Linux Machine as like below.

dev@dev-VirtualBox ~/Desktop/CSV $ pwd
dev@dev-VirtualBox ~/Desktop/CSV $ ls
dev@dev-VirtualBox ~/Desktop/CSV $ cat <<EOF >sample.csv
> 1,FIRST_LINE,18-JAN-2018
dev@dev-VirtualBox ~/Desktop/CSV $ ls
dev@dev-VirtualBox ~/Desktop/CSV $

Once the file is created it will look something like below:


Now let us think that this file is on a SFTP server where we need to connect and append another line without renaming or changing the file format.

Login to the server

login as: dev
dev@'s password:
Welcome to Linux Mint 18.3 Sylvia (GNU/Linux 4.10.0-38-generic x86_64)

* Documentation:  <a href=""></a>
Last login: Tue Jan 23 09:55:52 2018 from
dev@dev-VirtualBox ~ $ ls
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos
dev@dev-VirtualBox ~ $ cd Desktop/
dev@dev-VirtualBox ~/Desktop $ ls
dev@dev-VirtualBox ~/Desktop $ cd CSV/
dev@dev-VirtualBox ~/Desktop/CSV $ ls

So now we can login to the server.

Method 1: Now let us execute the below line to insert or append a new row to the existing CSV file i.e. sample.csv:

dev@dev-VirtualBox ~/Desktop/CSV $ sed -i.bak 1i"2,Second_Line,18-JAN-2018" sample.csv
dev@dev-VirtualBox ~/Desktop/CSV $

Once the above line is executed we will see the row is inserted but not at the end but at the beginning.


Now how we can append the line at the end .

dev@dev-VirtualBox ~/Desktop/CSV $ pwd
dev@dev-VirtualBox ~/Desktop/CSV $ ls
dev@dev-VirtualBox ~/Desktop/CSV $ cat sample.csv
dev@dev-VirtualBox ~/Desktop/CSV $ sed -i -e "\$a2,Second_Line,18-JAN-2018" sample.csv
dev@dev-VirtualBox ~/Desktop/CSV $ cat sample.csv
dev@dev-VirtualBox ~/Desktop/CSV $


The line used to insert the row/ append the row at the end is :

sed -i -e "\$a2,Second_Line,18-JAN-2018" sample.csv

Method 2: Now let us check how we can use echo to insert the line at the end.

dev@dev-VirtualBox ~/Desktop/CSV $ echo "3,Third_Line,18-JAN-2018" >> sample.csvdev@dev-VirtualBox ~/Desktop/CSV $ cat sample.csv
dev@dev-VirtualBox ~/Desktop/CSV $

Method 3: Append using a simple python programming

dev@dev-VirtualBox ~/Desktop/CSV $ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> with open('sample.csv', 'a') as file:
...     file.write('4,Fourth_Line,18-JAN-2018')
... ;
   File "<stdin>", line 3
SyntaxError: invalid syntax
>>> with open('sample.csv', 'a') as file:
...     file.write('4,Fourth_Line,18-JAN-2018\n');
>>> exit()

Finally, the file will look like as below:

dev@dev-VirtualBox ~/Desktop/CSV $ cat sample.csv

dev@dev-VirtualBox ~/Desktop/CSV $




To automate the process you can create a script and try to pass the row as a input to the file while calling the script.


Thank you for reading my blog , please feel free to leave me some feedback or to suggest any future topics.

Looking forward to hear from you – Swadhin Ray (Sloba) -( LinkedIn ) ( Twitter )


Reorder the columns in CSV file using Python

Many time we work on files to load or process the flat files. In this post, I am showing if we receive the file but the columns are not in order then how to rearrange them in the right format. There are multiple ways to handle this but here I am using a simple python code which will reorder my columns.

Say for example my right order of my file should be as below:

 empno, ename, sal 

But say I receive a file with

 sal, ename, empno 


Now here is the simple python script which will change the file into right order :

import csv

with open('file2.csv', 'r') as infile, open('file2_modified.csv', 'a') as outfile:
fieldnames = ['empno','ename','sal']
writer = csv.DictWriter(outfile, fieldnames=fieldnames)
for row in csv.DictReader(infile):

Save the above code as “” or anyname you want.

Execute the python script , and check the result.


You can modify the code in various ways as per your need.

Thank you for reading my blog , please feel free to leave me some feedback or to suggest any future topics.

Looking forward to hear from you – Swadhin Ray (Sloba) -( LinkedIn ) ( Twitter )

Access Windows shared directory from Ubuntu 16.04.3 LTS VirtualBox Guest

In this post I am going to show how to access windows shared directory from Ubuntu 16.04.3 LTS virtual machine.

First create a directory on the host. For example I am creating one directory called on my E drive [ My host is Windows 7 ] .

Now open VirtualBox go to settings of your Ubuntu guest, under shared section add your directory that was created with full permission. Once this is completed login to Ubuntu virtual machine and type the below:

 sudo usermod -aG vboxsf $(whoami) 

Executed on my machine as like below:

sloba@sloba-VirtualBox:~$ sudo usermod -aG vboxsf $(whoami)
[sudo] password for sloba:
sloba@sloba-VirtualBox:~$ reboot

After that reboot your Ubuntu machine you can access the shared drive as shown below.

sloba@sloba-VirtualBox:~$ ls
Desktop Downloads Music Pictures Templates
Documents examples.desktop oraInventory Public Videos
sloba@sloba-VirtualBox:~$ cd /media/
sloba@sloba-VirtualBox:/media$ ls -lrt
total 12
drwxrwx--- 1 root vboxsf 0 Jan 22 21:12 sf_vmshare

sloba@sloba-VirtualBox:/media$ cd sf_vmshare/


Thank you for reading my blog , please feel free to leave me some feedback or to suggest any future topics.

Looking forward to hear from you – Swadhin Ray (Sloba) -( LinkedIn ) ( Twitter )



Isolating Your System with Linux Namespaces

With the advent of tools like Docker, Linux Containers, and others, it has become super easy to isolate Linux processes into their own little system environments. This makes it possible to run a whole range of applications on a single real Linux machine and ensure no two of them can interfere with each other, without having to resort to using virtual machines. These tools have been a huge boon to PaaS providers. But what exactly happens under the hood?

These tools rely on a number of features and components of the Linux kernel. Some of these features were introduced fairly recently, while others still require you to patch the kernel itself. But one of the key components, using Linux namespaces, has been a feature of Linux since version 2.6.24 was released in 2008.

Anyone familiar with chroot already has a basic idea of what Linux namespaces can do and how to use namespace generally. Just as chroot allows processes to see any arbitrary directory as the root of the system (independent of the rest of the processes), Linux namespaces allow other aspects of the operating system to be independently modified as well. This includes the process tree, networking interfaces, mount points, inter-process communication resources and more.

Why Use Namespaces for Process Isolation?

In a single-user computer, a single system environment may be fine. But on a server, where you want to run multiple services, it is essential to security and stability that the services are as isolated from each other as possible. Imagine a server running multiple services, one of which gets compromised by an intruder. In such a case, the intruder may be able to exploit that service and work his way to the other services, and may even be able compromise the entire server. Namespace isolation can provide a secure environment to eliminate this risk.

For example, using namespacing, it is possible to safely execute arbitrary or unknown programs on your server. Recently, there has been a growing number of programming contest and “hackathon” platforms, such as HackerRank, TopCoder, Codeforces, and many more. A lot of them utilize automated pipelines to run and validate programs that are submitted by the contestants. It is often impossible to know in advance the true nature of contestants’ programs, and some may even contain malicious elements. By running these programs namespaced in complete isolation from the rest of the system, the software can be tested and validated without putting the rest of the machine at risk. Similarly, online continuous integration services, such, automatically fetch your code repository and execute the test scripts on their own servers. Again, namespace isolation is what makes it possible to provide these services safely.

Namespacing tools like Docker also allow better control over processes’ use of system resources, making such tools extremely popular for use by PaaS providers. Services like Heroku and Google App Engine use such tools to isolate and run multiple web server applications on the same real hardware. These tools allow them to run each application (which may have been deployed by any of a number of different users) without worrying about one of them using too many system resources, or interfering and/or conflicting with other deployed services on the same machine. With such process isolation, it is even possible to have entirely different stacks of dependency softwares (and versions) for each isolated environment!

If you’ve used tools like Docker, you already know that these tools are capable of isolating processes in small “containers”. Running processes in Docker containers is like running them in virtual machines, only these containers are significantly lighter than virtual machines. A virtual machine typically emulates a hardware layer on top of your operating system, and then runs another operating system on top of that. This allows you to run processes inside a virtual machine, in complete isolation from your real operating system. But virtual machines are heavy! Docker containers, on the other hand, use some key features of your real operating system, including namespaces, and ensure a similar level of isolation, but without emulating the hardware and running yet another operating system on the ……continue reading…..




Thank you for reading my blog , the reference is taken from one of the article that was published by  Mahmud Ridwan on Toptal.
Please feel free to leave me some feedback or to suggest any future topics.

Looking forward to hear from you – Swadhin Ray (Sloba) -( LinkedIn ) ( Twitter )

Linux Best Practices and Tips

This resource contains a collection of Linux best practices and Linux tips provided by our Toptal network members. As such, this page will be updated on a regular basis to include additional information and cover emerging Linux techniques. This is a community driven project, so you are encouraged to contribute as well, and we are counting on your feedback.

Linux is powerful, flexible, and can be adapted to a broad range of uses. While best practices for administrating Linux servers are not hard to find due the popularity of the operating system, there is always a need for up-to-date Linux advice, along with the best tips, from our experienced Toptal Linux administrators.

Check out the Toptal resource pages for additional information on Linux .……continue reading…..


Thank you for reading my blog , the reference is taken from one of the article that was published by

Rogelio & Zlatko  on Toptal. Please feel free to leave me some feedback or to suggest any future topics.

Looking forward to hear from you – Swadhin Ray (Sloba) -( LinkedIn ) ( Twitter )