Pages

Sunday, February 7, 2016

Bash Scripting

 What is a Shell Script...?                     


   In Unix the users  can enter commands either directly or through a file with set of written commands in it. It is called a shell program or a shell script. These shell scripts are interpreted, and not compiled. That is the shell reads commands line by line from the script and searches those command in the system.In other words, shell script is a computer program designed to be run by Unix Shell.

Above describes a basic function of a shell : passing commands to the kernal.
        

 Shell Types

 

 Why Bash......?   


                     Bash is the GNU shell and it is a sh compatible shell. It incoorporate useful features from other shells thus shows a functional improvements than others

  • interactive shell
  • allows integer arithmetic
  • shell maintains a list of aliases and they allow a string to be substituted for a word
  • provides one dimensional arrays of unlimited size
  • unlimited size command history
  • provide job control commands like jobs ,fg,bg,wait,kill,suspend,killall etc.

 Executing a program from a script


                 When there is a shell script to be executed, bash will create an exact copy of it and creates a new process. This child process created has the same environment as its parent, but  only its process ID number is different. This process is referred as Forking.

                 Now the child process created runs and the parent awaits till it finishes. During the process, the sub shell reads one line from the shell script at a time and then interprets and executes it. Once every line in the shell script is read, the sub shell terminates and the parent shell awakens to give a new prompt


 

Friday, February 5, 2016

Unix

Introduction

Linux and Unix were two terms which bothered me which ultimately led me to compare them and have a vivid understanding.


Unix is a stable  multi-tasking, multiuser computer operating system. It was first developed in 1960s.
The main three composition of the Unix Operating System can be depicted as follows


The Directory Structure in Unix is important when understanding its basics. Everything in Unix can be reduced to a file. Unix files are integrated into a single directory structure.  The directories have specific purposes and generally store the same type of information. Following are the directories that exist on Unix versions and the type of files stored.





This file system is arranged in a Hierarchical manner like an inverted tree. The top of the hierarchy is the root (/) and all other directories spread from there.


In the above diagram, the home directory of the undergraduate student "z3065" contains two sub-directories (doc and pics) and a file called report.doc.

The full path to the report.doc is referred to as "/ home/turing/z3065/report.doc"



Commands Used Working with directories

 

 


File System System Security

             Security is a prime concern in Linux Systems. The basic security of linux system is based on file permission.

             In Unix-like systems File Prmission is managed in three different scopes or classes.
  • Owner :-  who has the control over the permission settings of the file. He can define the file's group class. Can be a member of the assigned group

  •  Group :-  files and directories are assigned to a group of members. 

  •  Users  :-  users who are neither the owner nor in the group are included in this class.


              Permissions are set of bits which can be set or reset to allow certain type of access to it. Unix systems implement three sets of permission that apply to each class. It is worthy to consider that same set of permission have different meaning on files and directories.




 ls -l command gives lots of details about the contents of your directories including the access rights on files. Below shows an instance and its meaning.



Thursday, February 4, 2016

First week at hSenid



FIrst job is undoubtedly a life flag of every  persons' life. So was mine.... !!!

I looked for something really different, not boring and something exiting.... When I went for several interviews I couldn't explain that feeling when they asked..
"Do you think you get what you hope from this job...?" Because honestly my satisfaction was not satisfactory....

Accidently I was told about a Japanese Apprenticeship Program at hSenid Mobile by my college. I never imagined that would be the turning point of my life till I went to their introduction session... !!! there when they told that we are taught Japan language, Japanese culture together with the technical areas , my gut said that would be MINE definitely..... :)




The first day of my first carrier was on 1st February 2016 at hSenid Lanka Company with another four members in the Japanese team, Maheshika from Kandy, Dinisha from Nugegoda, Menuka from Matara and Kasun from Panadura. We are going to work together for a looong 4 years from today amidst different cultures, different attitudes, different talents..... But yet as ONE team.




First and foremost, Mr. Dinesh Saparamadu, the CEO of hSenid Lanka Company gave an introduction about the hSenid Lanka, one of hSenid company and about its maintained core values and the culture








After that, we were further motivated by the stunning speech of Mr.Harsha, the CTO of hSenid Lanka. He gave a good foundation thought for our carrier. The summary of his explanation can be shown as the diagram below.