Author: Rahul

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

We can use an internal field separator (IFS) variable to parse an array. Let’s use an example script, where first we define a string with colon-separated. Then we will use IFS to separate values based on a delimiter.

Let’s execute this script and check for results. ./myscript.sh Output: orange grapes banana apple

Read More

Command SNAME=$(basename “$(test -L “$0” && readlink “$0” || echo “$0″)”) While running a bash script using Linux terminal the script name can also passed as argument at $0. but if we are using full path of script to execute, it will show full path as results when print value of $0. So use above command will exactly provide only script name. It also handle if you are running any bash script using symbolic link. Example: Create a script named test.sh and add following content in script. #!/bin/bash SNAME=$(basename “$(test -L “$0” && readlink “$0” || echo “$0″)”) echo “Your…

Read More
DNS

MX records in DNS are used to route emails to correct mail servers and properly send to correct destination server. If you are using Google apps account for hosting email accounts on Google servers for your domains, then you need to add following MX records in your domains DNS configuration. Google Apps MX Records: @ IN MX 1 ASPMX.L.GOOGLE.COM @ IN MX 5 ALT1.ASPMX.L.GOOGLE.COM @ IN MX 5 ALT2.ASPMX.L.GOOGLE.COM @ IN MX 10 ALT3.ASPMX.L.GOOGLE.COM @ IN MX 10 ALT4.ASPMX.L.GOOGLE.COM

Read More

Generally Ubuntu users used Synaptic Package Manager for GUI and apt package manager for command line for installing packages. But not all latest application’s provides pre compiled packages for system, In that case you need to compile it using source code for installing application on your system. This article will help you for installing packages using source archive on Ubuntu systems. Prerequisites Before working with the compilation of source package, First we need to prepare our system with requirements for compilation. $ sudo apt-get install apt-file autoconf build-essential checkinstall Extract Source Package Firstly download the source archive on your system…

Read More

Command: md5sum myfile.php > myfile.php.md5 Above command will generate md5 checksum of file myfile.php and store in file myfile.php.md5. myfile.php.md5 can be used to verify integrity of file anytime. Generate MD5: If we want to generate md5sum of a file named index.php. Use the following command to do it and store generated md5 value of file in index.php.md5 file. # md5sum index.php > index.php.md5 Verify MD5: Now in future we can use index.php.md5 to verify integrity of file using following command. This command will show output as OK or FAILD. # md5sum -c index.php.md5

Read More

Linux, much like any other operating system, relies on processes for its operations. Occasionally, these processes may become unresponsive or consume excessive system resources, necessitating their termination. The following article presents a detailed guide on how to kill a process by its name in Linux, a crucial skill for Linux users and administrators alike. What is a Process? Before we dive in, it’s crucial to understand what a process is. A process, in the simplest terms, is an instance of a program in execution. Each process has a unique identifier called a Process ID (PID), which the operating system uses…

Read More

We can easily get values passed in url query string using JavaScript or jQuery. Here is an simple examples of getting query string values with JavaScript. To do this create a function like getParamValuesByName and add one of example codes given below. In the below examples function getParamValuesByName() will parse the query string values and returned matching values based on there named passed as parameter. Example 1: <script type=”text/javascript”> function getParamValuesByName (querystring) { var qstring = window.location.href.slice(window.location.href.indexOf(‘?’) + 1).split(‘&’); for (var i = 0; i < qstring.length; i++) { var urlparam = qstring[i].split('='); if (urlparam[0] == querystring) { return urlparam[1];…

Read More

This tutorial will help you to redirect a webpage to another webpage using JavaScript. Here are 3 examples of redirecting webpage to another with JavaScript. Example 1: We can redirect user to other page using window.location.replace in JavaScript. window.location.replace has pretty similar to an HTTP redirect.

Example 2: It is better to use window.location.href in place of window.location.replace, because replace() function does not put the originating page in the session history.

Example 3: We can also simply redirect to any internal website page using window.location.

Read More

The JavaScript indexOf() method search for the substring in string and returns the position of the first occurrence of a specified substring. If substring not found, it returns -1. So you can use JavaScript IndexOf() method to check if a string contains substring in it. In this tutorial we will also provides example to use JavaScript includes() and search() methods to find substring in another string. In a comparison of all 3 methods describes below, indexOf() can be better due to its speed of execution. If no speed matters, you can use any of the following methods. Using indexOf() Method…

Read More

Command: echo <password> | passwd –stdin <username> Example: Use the following command to change password of user jack in a shell script. For example we are using string password as password. echo “password” | passwd –stdin jack Assigning User Input Password: Use the following commands to input password from user and assign to user jack. read -p “Enter Password for User jack: ” pwd echo $pwd | passwd –stdin jack Also we can prompt password twice from user to make confirmation that user has memorize it correctly. Use the following commands to input password twic from user and assign to…

Read More