For Legend look here

The Shell

The main program a user interacts with after login is the SHELL.
This is a program that interprets the user command and initiates the desired
actions.

The basic commands to know in unix are:

The shell program is a computer program that allows the user to enter a command
to the computer, that this then should execute.

There are several different programs that provide this functionality:

  • sh: Shell

    Basic shell program installed on any linux distribution

  • bash: Bourne Again Shell

    Shell program with some additional features.
    Configuration in

    $HOME/.bashrc
  • zsh: ZSH

    Advanced shell program, extensible and a lot features.
    Configuration in

    $HOME/.zshrc
  • fish: Friendly Interactive Shell

    A modern user friendly, but in some aspects not compatible to normal shell of
    unix.
    Configuration in

    $XDG_CONFIG_HOME/fish

Commands

Commands have a name without whitespaces and can have options or parameter
to alter their behaviour.

Parameters or Options of commands are seperated by spaces.
That means, if a parameter or option needs to include a space character, there
are two options:

  1. Escape Space: \␣
  2. Wrap in quotation marks: "␣"

Other special characters:

  • is used to encapsulate names/strings with spaces, and will also part of
    $Variable expansion, if needs to be used as such: \"

    "
  • same as ", but without variable expansion. Escape: \'

    '
  • > and < used in shells to redirect a stream to somewhere else.

  • (Pipe Symbol) used to send output of one command to another

    |

Input and Output of Shell

Unix shells have three builtin character streams:

  1. Output Stream STDOUT has number 1
  2. Error Output STDERR has number 2
  3. Input Stream STDIN has number 0
Working with input and output
  1. Repeat something from input to output:

    echo Text that will be repeated by shell
    # Text that will be repeated by shell
  2. Redirect STDOUT to File:

    echo Text that will go to STDOUT goes to file > file
  3. Redirect STDERR to STDOUT:

    some_command 2>1
    
    # Can be combined with other redirects:
    some_command 2>1 1> file
  4. Hand output of one command to another command to process further:

    some_command | another_command

Next:

The Basic Commands