Shell-scriptConcatenate two values in shell scriptingBash Script to concatenate variablesUse the below code to concate two strings. Example var='My' var="${var}love" echo $var Output Mylove .. Pass argument with single quoteBash script to pass argument with single quotePass argument with single quotes If you want to pass argument with single quotes just follow the below step Create file and type as echo $1 Execute file as sh hello.sh "pp'" Output: pp' Pass argument with single quotes sh hello.sh pp\' Execute file as above to pass the argument with single quote. .. Comment multiple lines in shell scriptingBash scriptHow to comment multiple lines in shell script <<COMMENT1 //Your codes here COMMENT1 (or) <<comment1 //Your codes here comment1 Comment Multiple lines in shell script to comment multiple lines. Comment a particular line or single line If you want to comment the particular line use the # symbol. # Your code This will comment the line your code. .. How to comment a line in shell scriptComment a particular line in shell scriptingComment the particular line If you want to comment the particular line use the # symbol. How to comment multiple lines in shell script <<COMMENT1 //Your codes here COMMENT1 (or) <<comment1 //Your codes here comment1 Comment Multiple lines in shell script to comment multiple lines. .. How to increment particular variable in shell scriptShell scripting increment a variableIncrement operation Use the below code to increment the particular variable. gg=0 gg=`expr $gg + 1` echo $gg expr command is used to increment the particular variable. .. How to execute shell scriptShell script beginning - Hello WorldHow to execute shell script Create file with extension as .sh Example: hello.sh echo $0 Execute File as # sh hello.sh Output of the above program is hello.sh .. Purge frozen messages in exim mail serverDelete frozen msg in exim serverPurge frozen messages in Exim # exipick -zi | xargs exim -Mrm The above command will delete all the frozen message in exim mail server. This command will be very much helpful when your exim mail server is frozen by mails. Delete frozen mails for i in `mailq | awk '$6 ~ .. What is linuxLinus operating systemLinux is a free open-source operating system based on Unix. Linus Torvalds originally created Linux with the assistance of developers from around the world. Linux is: => Free => Unix Like => Open Source => Network operating system .. Find recent earthquakes in bay areaTo see today's earthquakelynx --width=200 --dump 'http://quake.usgs.gov/recenteqs/Maps/San_Francisco_eqs.htm' | sed -ne '/MAG.*/,/^References/{;s/\[[0-9][0-9]*\]//;1,/h:m:s/d;/Back to map/,$d;/^$/d;/^[ \t][ \t]*[3-9]\.[0-9][0-9]*[ \t][ \t]*/p; }' | sort -k1nr To see only earthquakes for today, add another pipe to egrep "`date '+%Y/%m/%d'`" .. How to list all authors of a particular git projectGit project logYou can list all the authors of a particular git project using any one of the below two command's. # git log --format='%aN' | sort -u This should work even if the output format changes. You can also use the below command # git shortlog -s | cut -c8- List everyone who committed .. Overloading unix system until crashThis is a fork bombWARNING!! This command can produce to crash the unix system where you execute it. What this command do is to generate a lot of threads (so in practice => process) until the system is overloaded, and to recover it, it is needed a reboot of the machine. # echo && .. How to convert hexadecimal to decimalCommand to convert hexadecimal to decimalLinux command to convert hexadecimal to decimal numbers. # printf "%d\n" \0x64 Linux command to convert hexadecimal to decimal numbers. .. How to change directory using shell scriptingBash or ksh script to change a directoryTo change directory in a shell script use "cd" command. echo "Enter the directory name:" read dirname cd $dirname Enter the absolute path to change the directory. .. How to read user input from keyboardBash scripting read user inputTo read the user input you have to use the keyword "read" without quotes. echo "What is your name:" read name echo "Welcome $name" Copy the above shell script and place it in a file called myshell.sh [w3cal@localhost]# sh myshell.sh Enter file name: Jack welcome Jack The .. Bash scripting to kill mysql locked processKill mysql Locked connection by user nameThe below bash script will help you to kill all the mysql locked connection of a specific user. for i in `mysqladmin -h x.x.x.x --user=root -pXXXX processlist | grep <username>| grep <Locked>| awk {'print $2'}` do mysqladmin -h x.x.x.x --user=root -pXXX kill $i; done; substitute the username and process accordingly. .. |