Shell Script to Backup Files / Directories Using rsync

This article we bring shell scripts to backup your files / directories from you local linux machine to a remote linux server using rsync command. This would be an interactive way to perform backup , where you need to provide remote backup server hostname / ip address and folder location. We keep a separate file where […]

May 20, 2015 | By
| 1 Reply More

70 Shell Scripting Interview Questions & Answers

We have selected expected 70 shell scripting question and answers for your interview preparation. Its really vital for all system admin to know scripting or atleast the basics which in turn helps to automate many tasks in your work environment. In the past few years we have seen that all linux job specification requires scripting […]

May 18, 2015 | By
| 12 Replies More

Interactive Shell Script to Copy Files / Directory using SCP

Today we have interactive shell script that will copy files / directory to source to destination. This script will allow copy multiple files and directories. Script will only work assuming you have configured ssh key based authentication between two machines. Script will request to input destination hostname or ip address and path of destination folder. […]

May 8, 2015 | By
| Reply More

Learning Shell Scripting - First Step Guide !

Usually when people say "shell scripting" they have on mind bash, ksh, sh, ash or similar Linux/UNIX scripting language. Scripting is another way to communicate with computer. Using graphic windows interface (not matter windows or Linux) user can move mouse and clicking on the various objects like, buttons, lists, check boxes and so on. But […]

April 30, 2015 | By
| 1 Reply More

How to Show Dialog Box from Bash Shell Script with Examples

This tutorial will give couple of examples on how to use utilities like zenity and whiptail in your Bash shell script to provide message / dialog box . With these utilities your script will be able to inform user about the current state of execution, or give an ability to interact. Difference between these two […]

April 10, 2015 | By
| Reply More

4 Tools Send Email with Subject, Body and Attachment in Linux

In today's article we will cover a few ways you can use to send emails with attachments from the command line interface on Linux. It can have quite a few uses, for example to send an archive with an application from an application server to email or you can use the commands in scripts to […]

April 6, 2015 | By
| Reply More

Shell Script to Check Linux System Health

This article we are introducing a shell script to perform linux system health check. This script collects system information and status like hostname, kernel version, uptime, cpu / memory / disk usage. Script uses hostname, uptime, who, mpstat, lscpu, ps, top, df, free, bc commands to get system information and cut, grep, awk and sed for […]

September 10, 2014 | By
| 31 Replies More

Linux Shell Script to Sync Directories Interactively

This script will sync two directories between two servers. Basically we are using rsync features to run this program. Script will interactively request to input below details. 1) Remote server name or ip 2) Remote system user name 3) Local directory to sync 4) Remote directory to sync to 5) Check user need to copy timestamp […]

July 10, 2014 | By
| Reply More

Backup MySQL Database Using Shell Script

Regular backup of mysql databases are also as important as backing up your code. So I wrote this script to backup all of my databases on local disk. I then added gzip to compress the sql file to save disk space.  You can always copy them over network so as to retain multiple copies of […]

September 27, 2013 | By
| Reply More

How To Use Command Line Arguments In Shell Script

In a shell script, you can pass variables as arguments by entering arguments after the script name, for e.g. ./ arg1 arg2. The shell automatically assigns each argument name to a variable. – Arguments are set of characters between spaces added after the script. To specify an argument that includes spaces, you need to enclose […]

September 25, 2013 | By
| Reply More

Shell Script To Run Same Command In Directories & SubDirectories

This linux shell script allows system administrator to run same command in all folders and sub-folders. For example system administrator need to have list of all file or need to rename or delete etc. Linux Shell Script #!/bin/bash # we ask user to enter directory from where to start echo -n "Please enter directory from […]

July 15, 2013 | By
| Reply More

Linux Shell Script To Delete Empty Directories

Linux shell script that search for empty directories and delete them. If system administrator don't want to keep empty directories, this script can quickly remove all of them. You can input the path where you need to search for empty directories. Script will confirm before it deletes the empty directory. Linux Shell Script #!/bin/bash #Check […]

June 17, 2013 | By

Linux Shell Script To Find Kernel Version From Multiple Servers

Linux shell script that will login to server via ssh and get kernel version via uname -r command. List of all the servers are in server_list.txt file, script will take name by name and try to ssh with the root user and run uname -r command. Output will be written to variable and after into […]

June 13, 2013 | By
| 1 Reply More

Linux Shell Script: Find Memory Usage Of An Application/Program In Linux is a shell script that calculates linux memory usage for each program / application. Script outputs shared and private memory for each program running in linux. Since memory calculation is bit complex, this shell script tries best to find more accurate results. Script use 2 files ie /proc//status (to get name of process) and […]

June 5, 2013 | By
| 1 Reply More