DEV Community

loading...

BASH SHELL

5anthosh profile image Santhosh Kumar ・2 min read

This post was originally published on my blog, find original post here

What is shell ?

Computers understand the language of binary. In early days of computing, instructions were provided using binary language which is difficult to write and read.So, to make the intructions into readable understandable format , in an operating system there is a special program is called the shell. The shell accepts human readable commands and translate into something kernel can read and process those intructions.

The shell is a user program or an environment provided for user interaction. It is command language interceptor that executes the command from the standard input device like keyboard or from a file. The shell gets started when we log in or open a terminal (console).

The most common Linux shell is named "Bash shell".

Bash shell

The bash shell was inspired by Bourne shell. It is one of the most important softwares in a Linux system.

Shortcut for opening terminal in linux system is CTRL + ALT + T.

When we open the terminal , it will present us with prompt asking us to enter a command .santhosh is user name, ubuntu-18-04 is my system name.

santhosh@ubuntu-18-04:~$ _

~ in the prompt shows us that we are in user home directory.
if I am the root, then my home directory will be /.

To find out which shell we are using .

Use help command to print shell name and its version

santhosh@ubuntu-18-04:~$ help
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
These shell commands are defined internally.  Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.

or you can print system variable SHELL to get the shell

santhosh@ubuntu-18-04:~$ echo $SHELL
/bin/bash

echo is a command which is used to display message or system variable.

santhosh@ubuntu-18-04:~$ echo message
message

When we enter a command , it is actually stored in history (.bash_history file in home directory ), so we don't have to re-type the previously entered commands, we can just traverse this history using the up ⬆️ and ⬇️ down arrow keys.

we can display user name of user using simple whoami command.

santhosh@ubuntu-18-04:~$ whoami
santhosh

we can get documentation
or manual of commands using man

santhosh@ubuntu-18-04:~$ man whoami

To exit from the manual page, press q .

Discussion

pic
Editor guide