Remove all containners based on docker image name

How can I remove all docker containers based on a docker image name. I do not wish to remove all available containers, only the those which are based on particular image. For example I would like to remove all containers based on image centos:7.

To remove all docker containers based on centos:7 run the following linux command:

# docker ps -a | awk '{ print $1,$2 }' | grep centos:7 | awk '{print $1 }' | xargs -I {} docker rm {}

Read more

convert ebook to amazon kindle mobi using calibre - linux

How to convert various eBook formats for Amazon Kindle on Linux

Amazon currently accepts limited number of ebook formats that you can directly send to your Amazon Kindle. In this config we are going to show few Linux tools which may assist you with the conversion between various Document and eBook formats.

Based on your amazon Kindle type the supported formats may include:

  • Microsoft Word (.doc, .docx)
  • Rich Text Format (.rtf)
  • HTML (.htm, .html)
  • Text (.txt) documents
  • Archived documents (zip , x-zip) and compressed archived documents
  • Mobi book
  • Portable Document Format PDF
  • JPEGs (.jpg)
  • GIFs (.gif)
  • Bitmaps (.bmp)
  • PNG images (.png)


The first tool you might consider is ebook-convert. This tool is available on Fedora , CentOS, Redhat Linux under the package named ebook-tools. To install ebook-tools package run the command below:

# yum install ebook-tools

Read more

move vim text editor cursor left with h, move vim text editor cursor right with l, move vim text editor cursor up with k ,move vim text editor cursor down with j

Vim Tutorial


This tutorial has been written for both vi and vim. It starts with real basics, such as cursor navigation and ends with more advanced techniques like merging files.

For every section of this tutorial there is a short video with hints to help you understand how vim / vi works. Even that I have divided this tutorial into parts from novice to the expert user, there is plenty more what vim can do to make your work with vim editor easier and more efficient.

However completing this tutorial you will give sufficient knowledge about vim / vi and its features for your daily tasks.

Vim Novice level ( Vim Basics )

Moving cursor around

 move vim text editor cursor left with h, move vim text editor cursor right with l, move vim text editor cursor up with k ,move vim text editor  cursor down with j

In vim you can move cursor around with following keys h, l, k, j which is left, right, up and down respectively.

You can move cursor around also with arrow keys, however this is possible only if they are available.

Vim was designed for all kinds of terminals where arrow keys may not be available for you. Moreover, once you get used to using vim with h, l, k, j you will move more quickly than using arrow keys.

Open some text file and try use above keys now:

vim yourfile.txt

NOTE: You do not have to create a file prior to execution of the above command. If the file does not exists it will be created. If the file does exists it will be opened.

Read more

How to use a command line random password generator PWGEN on Linux

This article will provide you with some hints on how to generate random password using shell. Among many other tools which can be used on the Linux command line to generate random passwords such as openssl, mktemp, od or /dev/urandom the specific and easiest tool designed for this purpose is pwgen.


# apt-get install -y pwgen
# dnf install -y pwgen
# yum install -y pwgen

Usage examples

Let’s start by generating bunch of passwords by simple executing pwgen command. If no options are used pwgen will simply spit out 160 passwords with 8 characters each:

# pwgen 
AeD7Amiv Reech6ie dei7aiPe yoogh1Ch Quoh0zae shu2Eepa aoquu3Xa aiR4Raiv
eeWah9Ro uPhe9pif uZiegh2h xie6Mail wa2xaHai saeLoh4O Yai8be7u aGhue7fe
unieB3du yaiK7She ooh0ohGe Go5zuKai Aeseeph1 UJ3Moo5i xaeg6ohG aJ8oogah
suFo3ohr jaTee0mi eeK9zuoh tho5xieP Ec6uob9j iyap1eNo at1Hahqu viebei2O
zeeg9cuX iP9pooW6 ohS1nahl zaese9Vu dee1Tooh aS2Bahyu aeH5shoh hichooW6
Aishie2v phee8Ahp ce2Peith Ez0thoos oot0Aibo aizepe8J reeC6she aihaeSh6
EVaaroh1 apuviCh2 Ui2aec5t Yoh8jong eo2zaeWo queiTo7i aebai4Oe jahj5ieN
Co5aije5 ooSh1oon taeJe5ae Kah3quie eeXae6Ma wu6ohp8U Eil4sha4 iiSohc4a
eeNg0ied HaeH3ohl Shie9aih ohC5phoi boos6euG uadai3Oo Cohpai9I thuogh8E
thie7Zai aem6sooN ieFu7uif tiewoh4U Kaes1bai Aox4zah0 OoH5utoh uo4aWied
eew7baeV Iej7piel ohMa4iet Oi2aephi Yailov9t oaTheiz2 lexea9Ie iez0The2
et3Phaey hee2Oa7u Pee1Ibee ohbae1iZ thoo9eiZ eiCh3aiw Veiqu1ph quohF2oh
xoh2Iwo3 aiQuai8i aeKae5Hi owaiz3Ve oJa2ret8 yie4baiK iex3Chug ruPie2ig
Ahv7ciev kiemok7U veiX5cae thuL0Pho AiyeuB5t ooX4igeb bi0sohBu Ohl0hoaf
Wooy1ja9 ue8ooj3B iik5yeP5 Ieboo1oi neeNiu7E aeV8aimu oojeiW6x Thoh6Eix
zoaPh1au aiCh3eem quevoo8T Iey0soRo ceiC3Do4 Dae9ua4f pieyie2U noXu5ooK
Zuexe5du oNeu8eef heu7iTah kahpa8Um thoSa7sh Lai4Keik oit7Dahc aiy5iaZo
siv2Ut3a Tha8eePh eb6ieM2c DeVie1ee Cocofo7E Rihee6ya thi1Iigi iBi6quar
Adeeh6Us Eicho5so siTho2Pu Dahcho5I kowe7Iev gee9IeNu Ohso2jae Aegha1oo
Oomil4Ee Ahghoot3 Izai3oov yegeey6C ea8uG1ai Ahsh4Aeb quie5aeR paWaiqu4

Read more

apache mod SSL

APACHE web server and SSL authentication

Author: Jaroslav Imrich

apache mod SSLThis article describes configuration techniques of module mod_ssl, which extends a functionality of Apache HTTPD to support SSL protocol. The article will deal with authentication of server (One-way SSL authentication), as well as it will also include authentication of clients by using certificates (Two-way SSL authentication).


If you have decided to enable a SSL ( Secure Sockets Layer ) protocol on your web server it may be because you would like to extend its functionality to achieve an integrity and confidentiality for a data transferred on unsecured networks. However, this protocol with the combination of PKI ( Public Key Infrastructure ) principles can also along the side of integrity and confidentiality provide authentication between both sides involved in the client-server communication.

One-way SSL authentication allows a SSL client to confirm an identity of SSL server. However, SSL server cannot confirm an identity of SSL client. This kind of SSL authentication is used by HTTPS protocol and many public servers around the world this way provides services such as webmail or Internet banking. The SSL client authentication is done on a “application layer” of OSI model by the client entering an authentication credentials such as username and password or by using a grid card.

Two-way SSL authentication also known as mutual SSL authentication allows SSL client to confirm an identity of SSL server and SSL server can also confirm an identity of the SSL client. This type of authentication is called client authentication because SSL client shows its identity to SSL server with a use of the client certificate. Client authentication with a certificate can add yet another layer of security or even completely replace authentication method such us user name and password.

In this document, we will discuss configuration of both types of SSL authentication one-way SSL authentication and two-way SSL authentication.

Read more

How to name/label a partition or volume on Linux

Labeling partitions or volumes is a file system feature. There two main tools which can do the job of naming or renaming partition labels.
Namely they are tune2fs and e2label. Both tools are part of e2fsprogs and are used to solely on
ext2/ext3/ext4 file systems.

Both above mentioned tools will do the job of labeling your partitions or volumes where the only difference
is that e2label is dedicated solely for partition or volume labeling.

As it was already mentioned these tools will work only on ext2/ext3/ext4 file systems, that is you cannot label disk or partition or
volume which does not have ext2 or ext3 or ext4 file system.
does not

To display a partition label use e2label:

# e2label /dev/sda1 


Read more

sudo install, usage and sudoers config file basics

What if you want one user to run a command as an another system user without exchanging passwords. For example, you may want an user john to run a find command or custom bash shell script as an user greg or even as a user root ( superuser ) without password exchange. In this case a sudo utility with its /etc/sudoers configuration file will be your friend. This utility is very widely used but at the same time very little understood by Linux users of all levels.

This short article describes some basic of sudo usage and format of sudoers configuration file.

sudo install

First we need to make sure that sudo and /etc/sudoers the sudo configuration file is available. To do that run:

$ which sudo


$ sudo -V

The first command should reveal a location of a sudo binary executable and the second program will output a version number of sudo command its self. The sudo configuration file sudoers is in most cases located in /etc/sudoers. You can use ls command to locate this file.

$ ls -l /etc/sudoers
-r--r----- 1 root root 481 2010-04-08 21:43 /etc/sudoers

Read more

How to start a docker container as daemon process

Instead of running docker container with an interactive shell it is also possible to let docker container to run as a daemon which means that the docker container would run in the background completely detached from your current shell. The following CentOS docker container will start as a daemonized container using -d option, while at the same time executing ping using an endless bash while loop.

# docker run --name centos-linux -d centos /bin/sh -c "while true; do ping; done"

Read more

block access to

How to block Facebook access on Linux desktop

block access to facebook.comIn this config you can find an easy and cheap solution on how to block on any Linux desktop using /etc/hosts file. This is not a bulletproof solution but should help as a first level privacy protection for your kids, yourself or should aid if your students do not pay enough attention in the class.

Below you can find a list of subdomains:


Read more