Bash Command Basics – POFTUT

Bash Command Basics

Bash is a utility to manage Linux and UNIX boxes and it is very popular because of its simple, well documented and unique usage. There are alternatives to bash like csh,sh,ksh but bash has very high usage rate against others. I have recently work on bash with its manual and wanted to write something that I have learned from them. By the way, bash is an acronym for “Bourne again shell”.

Bash reads input and goes on a sequential manner. is treated as comment line like this.

Here is what really bash make.

  1. Reads script from various sources like terminal, file, etc.
  2. Than parses the string in the input and makes required expansions and then gets commands.
  3. Performs necessary directions
  4. Executes commands and wait for the completion of the commands for their status.

As you can see there is a lot of work to execute a command or script in bash. But all of them makes the commands run in a perfect manner.

Quoting

Quoting is clearing special words and strings from the script and make them work correctly. A non-quoted backslash escapes character for the bash. Using single quote preserves characters in the string even usage of backslash but with double quoting makes $  ‘  \ special. For example, \t is a tab.

Simple Commands

Generally, the line starts with commands and their arguments in bash and separated with blanks like this. Here ls is the command and /home/ismailbaydan is the argument. There may be a lot of arguments.

LEARN MORE  How To Create Snapshot of KVM / Libvirt / Qemu Vm?

Pipelining

The pipe is used to connect commands together. For example, to echo the content of the text file and look for a string is like this. grep uses the output of the cat command.

Timing

Timing is used to count CPU usage or time for a command. Here we make some copying and count for CPU usage.

 

Bash Command Basics Infographic

Bash Command Basics Infographic

Bash Command Basics Infographic

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy this blog? Please spread the word :)