How to extract substring in Bash

I have a bash shell variable called u= this is a test . How can I extract the “test” string and store into a shell variable?   A substring is nothing but a string is…

How to use KVM cloud images on Ubuntu Linux

H ow do I download and use a cloud image with kvm running on an Ubuntu Linux server? How do I create create a virtual machine without the need of a complete installation on an…

How to install Redis server on Ubuntu Linux 16.04

R edis is a free and open source (BSD licensed) key-value store. It is in-memory data structure store, used as a database, cache and message broker. How can I install Redis server on an Ubuntu…

How to flush Redis cache and delete everything using the CLI

I setup Redis cache for my web app. I want a blank database and get rid of all keys. How can I delete everything in Redis cache? How do I flush my Redis cache using…

How to enable and start services on Alpine Linux

H ow do I add or delete service at boot time on an Alpine Linux? How do I enable service such as Nginx/Apache at boot time on an Alpine Linux? How do I start/stop/restart services…

How to find and tar files into a tar ball

I would like to find all documents file *.doc and create a tarball of those files and store in /nfs/backups/docs/file.tar. Is it possible to find and tar files on a Linux or Unix-like system?  …

Unix command to find a file in a directory and subdirectory

I think I lost (or forgot the file location) a file named toms-first-birthday.mp4 on my Unix based system. Is there is a Unix bash shell command to find a file called “toms-first-birthday.mp4” in a directory…

How to use/run bash aliases over ssh based session

I have set up a bash alias named file_repl. It works entirely when I log in using ssh command. However, my bash aliases are not running over ssh, for example: $ ssh vivek@server1.cyberciti.biz file_repl bash:…

How to add ssh key to qcow2 Linux cloud images using virt-sysprep

I have installed and setup KVM server on an Ubuntu Linux. I downloaded various .qcow2 cloud images. How do I setup public ssh keys for downloaded CentOS/FreeBSD/Ubuntu cloud images using virt-sysprep?   You need to…

How to exclude file when using scp command recursively

I need to copy all the *.c files from local laptop named hostA to hostB including all directories. I am using the following scp command but do not know how to exclude specific files (such…