Category Archives: Unix

Line count of file

We all have been there waiting for a huge file to load in our fav editor. Knowing the number of lines in the file does not hurt. Check out below commands: Windows: find /c /v “hffhsdfsdlkfjsdlfj” <file_path> /c – Displays … Continue reading

Rate this:

Posted in Unix, Windows | Tagged , , , , , | Leave a comment

Shell script with array parameters

Hello Readers, This post shows an example to write a shell script that accepts 2 array parameters. The size of array parameters need not be same. Below script takes 2 array parameters and just prints the elements. Usage: Output: If … Continue reading

Rate this:

Posted in Unix | Tagged , , , , | Leave a comment

Shell script delete files by pattern

Respected Readers, Sharing a shell script that delete all files in a particular dir that match a pattern. The same can also be achieved by a combination of find and rm commands. This script can be called from a master … Continue reading

Rate this:

Posted in Unix | Tagged , , , | Leave a comment

Shell script to find disk space

Respected Readers, This post is about getting email alerts when application disk space crosses a threshold. It is a common requirement to get alerts so that one can be proactive rather than reactive. Recently, I was asked to write such … Continue reading

Rate this:

Posted in Unix | Tagged , , , , | Leave a comment

Invoke SQL script from Shell script with Parameters

Respected Readers, Often we have to write shell scripts that does some work (capturing daily data feed for eg) and then invoke a sql script (to persist captured data). You may or may not require to send parameters. Below provides … Continue reading

Rate this:

Posted in Unix | Tagged , , | Leave a comment

Unix change file permissions by owner

Hi Readers, Lets say you want to change file permissions of all the files that you own in a particular directory. In such case, find command can be used to get all files for a particular user and chmod command … Continue reading

Rate this:

Posted in Unix | Tagged , , | Leave a comment

Unix change group permissions recursively

Estemmed Readers, Lets say you want to change group permissions of all files and directories inside a directory. Following command can be used to do that: chgrp -R groupname pathofdirectory This command will only change the group of all files … Continue reading

Rate this:

Posted in Unix | Tagged , , , | Leave a comment