Unix

Basics of Screen

Why haven’t I heard of screen before? So useful! Start up a screen session and you can detach/resume on another computer. Long running task you want to keep tabs on but need to move computers no longer an issue. Start a Screen Session Creates the Screen Session with given name. You can use this name

// Unix //
Read More

How to obtain the full absolute path of the exectuing shell script without readlink

One issue that I always come across when creating a shell script is referencing files dynamically based on the location of the shell script. A hack I often used was to pass the script’s path to the script on execution because the readlink command was not available to me. However recently I have revisited this

Dynamically generating the Java Classpath within a shell script

One of the main maintenance issues with running a Java application from a shell script is keeping your classpath up-to-date with the new and updated jars. To make things more difficult you can’t specify a folder as the classpath as it doesn’t include the jars in it only .class files. However through the use of

Passing Arguments or Variables to a Bash Script from the Command Line

Often when working with Bash scripts we find that we want to add some options to the script by way of arguments or variables. Easily enough Bash command line arguments can be accessed by $1, $2, etc within the script where $1 is the first argument or variable and #2 is the second etc. Example:

Tips & Tricks: Comparing Text Files in Unix with DIFF command

When working in a unix environment you may find the need to compare the contents of 2 files. To do this unix provides the diff command. The diff command takes 2 files as an argument and outputs the differences between them in a simple easy to understand format using a simple change notation using numbers

How to run a Java Application from Bash Script

As one that seldom finds himself having to run Java Applications from a Unix Bash Script, I thought it would be helpful to share the appropriate commands i use to execute the code and to notify the user of success or failure. For reference the folder structure I use is: app_name – lib – config

// Java // Unix //
Read More

Tips & Tricks: Removing ^M from files in unix

When transferring files between Windows and Unix you may find that on occasions your file has been modified and that ^M characters exist at end of lines.  This problem is caused when files are transferred to the server as Binary. However if you change the type to ASCII then you will find that the ^M