Archives for Linux - Page 2
Shell script to pass multiple arguments with options
Shell script to pass multiple arguments with options This tutorial will help you to pass multiple arguments in a more organized manner. I have used two arguments "t" and "d" here. The first argument "t" will accept task value and based on the task value you can perform the respective…
Deleting Lines Containing Specific string from multiple files
Deleting Lines Containing Specific string from multiple files Deleting Lines Containing Specific string from multiple files recursively Syntax: grep -Rl "STRING" /directory/path/ | xargs sed -i "/STRING/d" Example: Below example delete lines containing @license tag from src/main/php directory all files recursively grep -Rl "@license" src/main/php | xargs sed -i "/@license/d"…
Get the List of Files and Directories Recursively in Linux
Simple bash Script to get the list of files and directories inside the specified path Sometimes we want to get the list of files and directories recursively, but it is tedious to navigate each directory to check all the files. Here are the simple commands which will help you to…
Install Opencv in CentOS
What is OpenCV? OpenCV (Open Source Computer Vision Library) is an Open Source Library for computer vision, machine learning and image processing. You can use OpenCV with multiple programming languages like Python, Java, C++. OpenCV can be used to process the images, identify objects, face detection, real-time traffic monitoring, lane…
Install RPM in CentOS
Install RPM in CentOS RPM Package Manager (RPM), originally called the Red-hat Package Manager, is a program to install or uninstall software packages or libraries in Linux. To install RPM in CentOS, first download the RPM: $ wget now check in your directory will be available for install RPM in…
Rename all Files in the Directory
Here is the simple shell script to rename all files in the folder with increasing number. In below example I am going to rename all jpg image with increasing number. #!/bin/bash a=1 for i in *.jpg; do new=$(printf "%" "$a") mv -- "$i" "$new" let a=a+1 done Output: Few more…
Run Mysql Query from Command Line
Shell script to run mysql query from command line without login into mysql command prompt. You can use these shell script for quickly execution of MySQL query from a Linux Shell. Method 1: #!/bin/bash #Script to run mysql query from command line #Db Connection. DB_USER='root' DB_PASSWD='mypwd' DB_NAME='mydb' #Prepare sql query QUERY='select *…
Start mysql service if not running
Here is the simple shell script check the MySQL service status, if MySQL service is not running then start MySQL service. #!/bin/bash SERVICE='mysql' if ps ax | grep -v grep | grep $SERVICE > /dev/null then echo "$SERVICE service is running." else echo "$SERVICE is not running" service mysqld start…
Apache Bench for load testing and performance benchmark
Apache Bench for Load Testing AB( Apache Bench) is a command line utility to measure performance of any web server. It's originally designed to test the Apache HTTP server. AB is free open source software and distributed under the terms of the Apache License. It's good practice to Benchmark performance…
Siege a simple load testing and benchmarking tool
Siege is simple load testing and benchmarking tool. Siege support GET and POST method to test your webservers through cookies, HTTP , HTTPS and FTP protocols. You can test single or multiple web urls in a single test . Installation on Linux : Download latest version Siege from official website…


