{ print “—————————————————————————” print “This script will do arithmetic operation (+, /, -, *) between two values ” print “command is num1 op num2 where op is the arithmetic command” print ” eg:- 2 * 3″ print “—————————————————————————” no1 = $1 no2 = $3 op=$2 if ( op == “*” ) ans = no1 *Continue reading “[Linux][awk]Implementation of arithmetic operations using awk”
Monthly Archives: December 2012
[Linux][Shell script] print fibonacci series of 12 numbers
#!/bin/sh# Fibonacci series – eg:- “0 1 1 2 3 5 8 13 21 34 55 …” a=0 #First value of the seriesb=1 #Second value of the series#print the first value of the series.echo $a#print the second value of the series.echo $b#Now a small mathmatics for finding other numbers in the series . for IContinue reading “[Linux][Shell script] print fibonacci series of 12 numbers”
[Shell Script][bash]Finding factorial of a given number using shell script
#!/bin/bash #This script will print the factorial of the number passed as arguement . eg:- ./factorial.sh 4 will print 4! value number=$1 factorial=1 i=$number while [[ $i != 1 && $i != 0 ]] do factorial=`expr $factorial \* $i` i=` expr $i – 1 ` done echo “Factorial of $number is $factorial”
[Linux][Commands]How to find files by its size in a directory
find dir_name -size 50M –> This command is for finding files with size 50MB find dir_name -size -50M –> This command is for finding files with size smaller than 50MB find dir_name -size +50M –> This command is for finding files with size bigger than 50MB where the dir_name is theContinue reading “[Linux][Commands]How to find files by its size in a directory”
[Linux]how to find physical memory of an Linux system
The physical memory is represented in /proc/kcore. The size of /proc/kcore is the same as System’s physical memory, plus four bytes .
[Linux]how to see the new hardware detected in linux
You can see hardware detected by kudzu in /etc/sysconfig/hwconf. Kudzu is software from Red Hat for automatic discovery and configuration of hardware.
[Linux]How to run Red Hat Setup Agent on next boot
remove the file , /etc/sysconfig/firstboot run chkconfig –level 5 firstboot on
[Linux]How to get description of the file system hierarchy
if we execute “man hier” command in the terminal, the description of the file system hierarchy will be displayed.
[Linux][C]How to display readable ASCII strings found in binary files
If you have one binary file and if you want to see the file content (readable ASCII strings ), then use Linux strings command man strings -> print the strings of printable characters in files eg: strings a.out which will print all the readable ASCII strings found in the a.out file
[Linux]How to display last few lines of a file without opening the file
Using “tail” command , we can display last few lines of a file without opening the file eg: tail -5 filename