vagrant box to libvirtd (QEMU) VM

Like ova images, you can use box images as well with Qemu. After all, both have the disk images, so here is the script to do that. Just put the script somewhere in your path and run with ova or box image name :


#!/bin/bash - 
#          FILE:
#         USAGE: ./ 
#       OPTIONS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Amit Agarwal (aka),
#       CREATED: 12/28/2017 13:59
# Last modified: Sun Mar 11, 2018  12:01PM
#      REVISION:  ---

set -o nounset                              # Treat unset variables as an error

if [[ $# == 0 ]]
    echo "You need to provide ova/vmdk filename"
if [[ $1 == *ova || $1 == *box ]]
    tmp=$(mktemp -d /tmp/amitXXXXXXX)
    cd  $tmp
    tar xvf $ORIG/$1
    file=$(echo $PWD/*vmdk)
    echo "Not a OVA file"
dfile="$dest/$(basename $file)"

read -p "Enter the name for VM :: " vmname
qemu-img convert $file $dfile -p -c -O qcow2
virt-install --disk $dfile --ram 512 \
    --virt-type kvm --vcpus 1 --name "$vmname" --import

Send history of current host to some other host over ssh

Sometimes I want to save the history of current host on another host. This is to ensure that I can use copy/paste on other host to run the commands. To this, I found a simple solution –

history| ssh <user>@<host> 'cat - > /tmp/history'

And on the new host, you can find the history in file “/tmp/history”, cool :). Now I can quick edit this file to create this as shell script as well if required. How cool is that.

asciinema – video for your terminal session

Info about asciinema:

Name         : asciinema
Version      : 1.4.0
Release      : 1.fc26
Arch         : noarch
Size         : 144 k
Source       : asciinema-1.4.0-1.fc26.src.rpm
Repo         : @System
From repo    : fedora
Summary      : Command line client (terminal recorder) for service
URL          :
License      : GPLv3
Description  : Asciinema is a free and open source solution for recording the terminal sessions
: and sharing them on the web.

To install, you can do:

dnf install asciinema


and here is and example:
Asciinema test video

Hope you find it useful if you have to show someone how to do something. Best part is – For just sharing a video link, you do not need to register as well 🙂