Getting started with BASH
So you wanted to be a system admin, or just want more power when using your computer. Then this article will help you know and understand some basic commands in BASH shell.

What is a SHELL?
A shell is a command interpreter that reacts to any command inputted into the command prompt. It can also be considered a programming language as it has variables, conditional operations, loops, and input and output operations.

So, why use BASH?
BASH or Bourne Again Shell is a replacement for the Bourne Shell (SH), it is a Linux shell, a command processor where we type in commands and it will give an output. It is the default Shell for most Linux Distributions and also MacOS, making it the fairly easy to access. It includes a lot of the best features of the C Shell and Korn Shell and also a lot of its own advantages. By learning on how to use it, we can schedule jobs such as shutting down, find duplicate files in the system, manage file permissions, edit file name and contents easily, and much more.

Can I use BASH on my computer/laptop?
Users of Computers/Laptops running Unix-Like systems such as Linux and MacOS can immediately use bash through the terminal. Whereas for windows user, using Virtual Machines running Linux distros is the best method to get the “Native” feel, a lighter alternative to Virtual Machines is using Unix-Like environments for Windows Such as Cygwin. After the release of Windows 10 version 16215.0, windows user can now enable the “Windows subsystem for Linux (WSL)” and install a Linux distro from the Windows Store. Though not as powerful as its Linux and MacOS counterparts, it still proves to be very useful as it help can run various commands not available before to windows user. A major advantage is that is highly integrated to windows and uses very little resources compared to running a virtual machine, and it comes with BASH as a default shell. You can also try to install applications such as Termux for android phones and BlinkShell or OpenTerm for ios though some may not be able to run BASH and may have their own unique shell, a lot of information from here can still be used.

Will there be a noticeable difference when I use different platform?
There exists differences in command usage and behaviours for different platforms, for example Linux distros and MacOS, we will use Ubuntu Linux Distro  Terminal and MacOS terminal for comparison. MacOS utilities will use the BSD version instead of the GNU version the Ubuntu uses, this may cause differences in behavior of the command and the flag. For Ubuntu, we usually use apt-get or apt to get and manage packages and applications for the system, whereas in MacOS, we usually use homebrew. The rest are subtle differences such as the order of flags in MacOS must be right after the command, whereas in Linux, the order usually does not matter.

Getting Started
This guide will be divided into 5 sub-sections get you started with BASH Shell,but that does not mean that things mentioned here will not work with other shell, as usually most shell have a lot in common. In order to know whether you are running bash, typing “echo $SHELL” will tell the shell to print out the name of your current shell, if it says something that ends with bash then you are good to go, if it does not, typing “bash” will change your current shell to bash.

To tell the shell what to do, we use Commands. Commands usually have the form: COMMAND –[OPTIONS] [ARGUMENTS].
Arguments is what the command needs to perform its action to, it can be a file, multiple files, mathematical expressions and even be the output of another command.
Options is usually known as command line flags, it usually there is a hyphen “-” before the flag, multiple flags can be put together.
i.e.: command –[option1][option2][option3] [argument(s)]
A useful command to know early on is ‘man’. It displays the manual pages for commands. It takes other command as its argument.
i.e.: man man

The example above shows the use of command ‘man’ with no options and the argument ‘man’. The command will output the name, synopsis, description and also all available options and its function for the command inputted as the argument.
Tips:
CTRL + C will stop any currently running command; it can be helpful when a command hangs. Using the tab key will most of the time auto complete the command or filename you are trying to type.

—– Continued in Part 2 ——
Author: Michael Gunawan (1901500111)
Supervisor: Dewi Suryani, S.Kom., M.Eng. (D5878)