Author: Sahil Suri

Simulating parallel process execution in Linux Bash

Introduction The default behavior of the bash shell and the Linux operating system is to execute typed commands sequentially in serial order. So, when we type multiple commands on the terminal prompt and chain them using semicolons then the shell would first execute one command, wait for it to finish execution and then execute the next command and so on. This sequential or serial behavior is fine for most scenarios but sometimes we may have the need to execute commands in a parallel fashion. The general requirement for parallel command execution arises from the necessity to save time i.e. do more in less time. Currently, there are many automation tools and utilities available that allow users to perform tasks parallel on the same system or across different systems. But what if we want to accomplish parallel task execution without installing any additional tools? By starting multiple processes in background appending the ampersand character (“&”) to the end of your commands, we can simulate the startup of multiple processes in parallel on the command line. Although this approach is not perfect but could suffice when we need to fire numerous commands in parallel on the same or different machines. The main alternative to running a process in the foreground is to allow it to execute in the background.  A background process is associated with the specific terminal that started it...

Read More

Linux tee command explained with examples

Introduction We may often find ourselves in situations wherein we are running some commands on our Linux/UNIX operating system and we need to display the output of the command to our terminal and save it to a file for future use as well. The Linux tee command is a utility that is meant to be used for precisely this purpose. We have already provided a quick introduction to the tee command in one of our earlier articles. In this article, we will discuss the different ways in which we could use the tee command in greater detail by means of practical examples. The tee command is part of the coreutils package and therefore should be installed on almost every Linux distribution out there. We’ll be using a Centos 6 machine for demonstrating the examples in this article. Example 1: Using tee command directly For our first and basic example, we’ll type the tee command followed by a file name and press enter. From hereon in anything we type on the terminal is redirected back to the terminal in the form of stdout and redirected to the file whose name we specified while invoking the tee command. Here is a demonstration. [root@linuxnix ~]# tee myfile.txt this is a basic tee command usage example this is a basic tee command usage example [root@linuxnix ~]# [root@linuxnix ~]# cat myfile.txt this is a basic tee...

Read More

Github and git integration

Introduction In the articles we’ve posted thus far, we’ve worked with git and saved changes by making commits on our local system. This is one way to use git i.e like a local backup system wherein we save the state of our files so that we may revert back to a specific state of a file if and when required. In this article, we will demonstrate how we may integrate our local git repositories with the GitHub code hosting and collaboration platform and also explain important terms and related vocabulary along the way. Given below is a pictorial representation of how to create, use and integrate our git repositories on local and remote systems. We may refer to this representation on multiple occasions throughout the length of this article. What is a remote? Using git as a local backup system is good but it’s not good enough because we may lose the local system and the data along with it in an unlikely event. So we may end up losing all our work. Now let’s introduce the term ‘remote’. In simple terms, you may consider a remote as any folder or place where you did not type ‘git init’ to create your git repository initially. The most common remote that we see is some cloud or Internet-based services. Among these services, GitHub is a very popular one. What is...

Read More

Over 16,000 readers, Get fresh content from “The Linux juggernaut”

Email Subscribe

ABOUT ME..!

My photo
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.