BASH shell

A bash is a power tool
No, undelete
No undo

Always read your input twice

Better safe than sorry
Fortunately, system resources are protected

Prerequisites:
No need to install or configure anything before using bash . its pre-installed. but for embedded systems, we need to be sure that we are using a bash.

Practicing : Use a toy on a virtual machine or make a private account without admin privileges

Bash on Linux:

The name depends on the system that we are using but below are few widely popular names :
Gnome: gnome-terminal
KDE: konsole
In general: look in the menu for “terminal”
Fallback: run “xterm”

For Linux without any graphical interface: Called X windows:
You will log in the shell directory

Commands:

ls – to list the files in the current directory
~: the telda character is for going to the home directory
cd: for change directory: example → cd ~/Downloads
If we say “cd “ and then press enter then we go to the home directory again
Pwd: present working directory.
If we need to list to all the directories inside a directory we need to go to that directory and then press “enter”. Like →
cd ~/Downloads
ls
cd..: moves to one directory backward
“echo $BASH”: outputs /bin/bash → this is to check if bash is running on your system. If the output is different then you are not running bash

Command line arguments:

The command line consists of words separated by spaces
The first word on every command line is the command
Everything after that is an argument
“cd Downloads”: here “cd” is the command and “Downloads” is the argument that says what it does.

Options:

Options usually start with a “-” after the command and it basically changes the way the command should behave. For example :
“ls -a” → lists all the files inside a directory including the hidden ones
“ls -l” → lists all the files in a directory in a long format
“ls -l -a “ → combines both the features of -a and – l. the shorthand for this would be “ls -la”
“ls -la /bin” → lists all the files in a long format from the bin directory
Order of the options does not matter. Thus “-la” is same as “-al”

Getting help :

To know what command has what specifications, we can take the help of Manual page. To open the manual page we use the command “man”

Example :
“man ls” → manual page for “ls” command
“man cd” → manual page for cd command
“Man man” → manual page for “man command”

History:

Bash keeps track of the history.To check the history of previously entered commands, we may use the “up arrow” or “ctrl+p” to go to the previously entered commands or may use the “down arrow” or “ctrl+n” to go the next entered commands.

Doubts? WhatsApp me !