Bash Shell In Linux
Introduction
I would always refer to Ubuntu for Linux. Bash shell is an interpreter which we can use to run commands interactively or a script. When we run commands interactively, we enter a command at a time and wait for the result of the command. When we write several commands in a file with extension .sh which is called a script. When we run a script, all commands inside the script is being executed sequentially.
Compiler Vs Interpreter
Unlike a compiler which converts the text format of a full program into the machine's binary format, an interpreter reads a single line at a time and executes it. In the case of compiler we get the compiled program and sometimes also some other intermediate files but in the case of interpreter we don't get any file.
File System
A file contains a bunch of data and resides inside a directory which contains several files and directories. As in a tree, a leaf is at the end of a branch and there is a hierarchy of branches, a file is inside a directory and there is a hierarchy of directories. This collection of files and directories is called a file system.
To refer a file or a directory in a file system, we can use either an absolute path or a relative path.
If we start our path from the root of the file system which is represented by / then it is called an absolute path e.g. /dir1/dir2/my_file.txt. Here, my_file.txt is inside dir2 which is inside dir1 which is inside the root of the file system.
If we start our path from the current working directory the it is called a relative path e.g. ../dir1/dir2/my_file.txt. Here, .. (dot-dot) refers to the parent directory of the current directory. There is also . (dot) which refers to the current directory.
In the future we will explore several file system related commands.
Happy reading and thank you. Meet you soon.
Comments
Post a Comment