By Kaitlin Logie, 20th October 2016.
What do you mean by ‘Unix Shell’?
Most of you would be very familiar with graphic user interfaces such as ‘explorer’ on Windows (not to be confused with Internet Explorer) which manages your desktop, icons, folders graphically for you to interact with. When you use the Unix shell, this is what is called a command line interface.
The command processor, the Unix shell, provides an interface between you and the Unix operating system. The Unix operating system is one of the most widely used operating system in software development, research and high performance computing. In simple words, the shell gathers input from you as the user and uses that input to execute certain programs. It then displays that output. The shell is an environment that makes it possible for us to run our commands, programs and shell scripts in a completely autonomous way.
If you had to find the maximum value of 1,000 samples, would you execute your program manually 1,000 times? No definitely not! As a researcher your time is valuable! The shell makes it possible to manually execute once, to execute your program 1,000 times without you having to be anywhere near your computer while this completes it’s output.
There are many different flavours of shell! Such as Bourne Shell (sh), the Bourne Again Shell (bash), C Shell (csh) etc.
The shell is an extremely important and useful research tool!
Just as other programming languages you might be more familiar with such as Python, the shell has it’s own syntax. The basic concept of a shell script is a list of commands, which are listed in the order of execution. You might have a program that you have written that displays graphically one data sample and then saves that to a file. You can write a shell script that helps you manage a large number of samples, by running your program on each sample autonomously. To do this you must treat the Unix Shell as it’s own programming language and write your own shell script. This is an extremely useful tool for researches as it compartmentalises their code making it easier to maintain each part!
(image by William Khoe)
Shell scripting is used over and over in high performance computing. When researchers need to submit jobs to the cluster, they need to know how to interact with the Unix Shell. It is a valuable and important skill for all researchers manipulating data to have in their toolbox.
How do i learn how to interact with the Unix Shell?
There are many online resources to help teach how to interact with all the different shells available. Software Carpentry provides one of the most reputable online lessons in the Unix Shell which is completely free and open source. If you want human interactive support with your Unix Shell development come along to our Hacky Hour and have a chat with us on how to develop with the Unix Shell. We will help you in any way we can! If you want more 1 on 1 email me at firstname.lastname@example.org to make an appointment and I will help you the best I can!