Scripting

How to install CPAN package and configure it in Linux?

CPAN(Comprehensive Perl Archive Network) is an online portal(http://www.cpan.org) and a repository of PERL modules written by community. The beauty of this online resource is we can download and install these modules in to your machine with CPAN command. This tutorial show you how to install and configure CPAN in Linux operating systems like Redhat, Fedora,(…)

12 examples to use flower brackets in Linux

This is a small post on how to crate multiple files/folders, sequence generation with flower brackets in-order to save valuable time. Creating empty files can be done with touch command. We will see how to create multiple files using this command in one shot Example1: Create a file with name abc.txt touch abc.txt Example2: Create multiple(…)

9 linux sort command examples to sort files

This is a small tutorial on how to use sort command to sort a file for some meaning full output. Sorting is very much useful when dealing with DB files, CSV, xls, log files in fact a text file to. By default sort command will sort according to alpha-bates. First sort tries to sort according(…)

Convert Binary,HEX, Oct to decimal in Linux/Unix

This is a small Shell tutorial on how to convert different bases to other bases. Some times when working as system admin you require to convert different number systems to others. In this post we will see how to convert different number systems to others. Decimal to Binary echo "obase=2; 23" | bc Output: 10111(…)

Learn SED with examples

This is our second post on SED, which is a Stream EDitor. Please find our Previous post on SED. You can find our other posts on RegExp basics and extended. Line number operator ( , and = switch) We can search in a file according to line numbers. Example13: Suppose I want to search in(…)

Linux/Unix redirection operators(File descriptors) explained with examples

Redirecting operators in Linux In order to understand about Redirecting operators in Linux we should know how we communicate with a computer. When we are communicating with a computer there should be a way to do it and this is achieved by STDIN (0), STDOUT (1), STDERR (2) file descriptors. These file descriptors are  assigned(…)

How to debug a Shell script in Linux

Debugging a shell script is very essential to check your script for any errors before moving in to production. In this post we will see different debugging tips and tricks useful for running your scripts without a flaw. Before debugging a script we have to learn how to write a shell script professionally in order(…)

Linux Shell built-in variables every system admin should know

There are many shell built-in variables which are used for administrating and writing shell scripts. In this post we will see important built-in variables and their importance. Please add any other built-ins which are useful for administration and for shell scripting. Note: in order get present values of these variables use echo command to get(…)

How to write shell script in Linux professionally

How to write a shell script professionally and why to write it? Most of the time when we work and write shell script we write on the go not considering others who want to understand it. Suppose you write a shell script and did not given any info what that shell script do, all your(…)

How to run a shell script in Linux

This is a small how-to topic on running the shell script you just received or created. The basic philosophy of Linux is to consider everything as files. And if you want to execute a file/app the permissions are set to executable on that file otherwise you will get permissions denied. Let’s try to execute a(…)