shell - ilya-khadykin/notes-outdated GitHub Wiki

Shell is a command-line interface, text-based user interface used to access to an operating systems's underlying services.

The most commonly used shell is bash (Burn again shell), but there are different shells:

  • zsh (Z shell)
  • ksh (Korn shell)
  • ash (Almquist shell)

Every shell has its own syntax for issuing commands, although there is often considerable overlap.

Customizing bash via .bashrc

You can customize your bash environment by editing .bashrc file in your user's directory. bash checks if .bashrc exhists and each line in this file is executed as if the user typed the line directly at the prompt.

Common customizations:

  • changing default prompt
  • add __alias__es for long commands
  • changing system default environment variables

.bashrc and .bash_profile are practically the same nowadays.

Environment variables

To see set environment variables use env

Common Environment Variables:

  • HOME - the current user's home directory
  • PATH - contains a list of directory paths. When a user types a command without providing the full path, bash will look at the directories in the PATH environment variable to see if they contain the given command.
  • PS1 - specifies how prompt is displayed
  • EDITOR - the default text editor
  • LANG - the user's language

Resolving environment variable:

echo $HOME