All Stories

List the contents of a tar or tar.gz file

Task: List the contents of a tar file</p> Use the following command:$ tar -tvf file.tarTask: List the contents of a tar.gz file Use the following command:$ tar -ztvf file.tar.gzTask: List...

Linux - copy file and preserve timestamp, ownership, mode

If you want to copy files in Linux and also want to keep or preserve the original mode or timestamp or ownership (or all) , cp command gives an option...

removing blank lines using AWK

cat tvly.log | awk '$0!~/^$/ {print $0}

Using bash variables in awk

C_DATE=$(cat $1 |grep "Processing" | sed "s/[^0-9]//g" )</p> cat $1 | awk 'BEGIN {RS="Data"; FS="\n";OFS=":" } {print $1,$5,$8,$9,$10}' | awk  'BEGIN {FS=":";OFS=":"}NR >1 {print $C_DATE,$1,$2,$3+0,"\tTotal Closed",$5+$7,$8,$9+0,"\tClosed%\t",(($5+$7)/$3)*100,"\tError%\t",($9/$3)*100  } will not work...

Script for File Details in your current Directory

using this Script you can see  File Details in your current Directory </p> #!/bin/bashecho "No of files in current in Directory"ls -l | grep ^- | wc -l echo "and...

awk summing coloumn values

I got lines in format  juned_workers 0.03322juned_workers 0juned_workers 0.17053juned_workers 0juned_workers 0.41322juned_workers 0juned_workers 0.16864juned_workers 0.05603juned_workers 0juned_workers 0.15836 The output I required was in format   Row1 juned_workers 0.03322Row2 juned_workers 0Row3 juned_workers 0.17053Row4...

Configuration management Linux- Chef Vs puppet

http://bitfieldconsulting.com/puppet-vs-chef</p> Good reading materal for puppet : http://www.sparksupport.com/blog/puppet-configuration-management-tool </div>

Setting Java Home using shell script

# Use JAVA_HOME if set, otherwise look for java in PATHif [ -x $JAVA_HOME/bin/java ]; then    JAVA=$JAVA_HOME/bin/javaelse    JAVA=`which java`    export JAVA_HOME=$(readlink -f $JAVA | sed "s:bin/java::")fi

UseFul Linux Commands - at one place

http://www.unixguide.net/unixguide.shtml

Restricting Shell Access

By default when you add new user to system (/etc/passwd file) it grant shell access, to avoid this for special users for which you dont want to give shell access...

Awk oneliner for convering float to interger

echo  2.52690284 | awk '{printf "%.0f",$1}'</p> if in bash script $SPEED="3.2" SPEED=$(echo $SPEED | awk '{printf "%.0f",$1}') echo $SPEED

fsniper

Recently was looking for a utility that will monitor particular directory for specific files and do some action on it once it find such file. for example trigger a script...

How to find and make all files blank

With this simple Find command , you can  find certain files and then make them Blank find . -name "*.cfg" -type f -exec cp /dev/null {} \;

Mukhbir: A movie to watch!!

Hi Guys, This is straight from the horses mouth. Being a big time movie Buff, you all can be rest assured that this one flick will note bore you and...

Outliers: The Story of Success

I just finished the book "Outliers: The Story of Success" by Malcolm Gladwell the key concepts of the book are that yes, it takes a lot of hard work to...

Eating order

One of my friend told me that, you need to eat rice before chapati (roti) as it is lighter food.So I just wonder what is the right eating order for...

Debt Free

It is the month of August, on the shores of the Black Sea . It is raining, and the little town looks totally deserted. It is tough times, everybody is...

InfoQ: Oozie by Example

InfoQ: Oozie by Example