Unix Basics – Shells, Environment Variables, AFS, ASL

terminal_icon

Shells

  • Shell basically provides a user interface, mostly command-line interface (CLI) for access to an operating system’s services.
  • A command-line interface (CLI) uses alphanumeric characters typed on a keyboard to provide instructions and data to the operating system, interactively.
  • Operating systems such as UNIX have a large variety of shell programs with different commands, syntax and capabilities.

Bash shell (bash)

  • Bash is a Unix shell written by Brian Fox for the GNU Projects as a free software replacement for the Bourne shell (sh).
  • Bash was released in 1989.
  • Bash is the default shell on Linux and Mac OS X.
  • The name itself is an acronym, a pun, and a description (the part most interests me)
    • Acronym: Bourne-again shell, referring to its objective as a free replacement for the Bourne shell.
    • Pun: it expressed that objective in a phrase that sounds similar to born again, a term for spiritual rebirth.
    • Description: the name is also descriptive of what it did, bashing together the features of sh, csh and ksh.

Bourne shell (sh)

  • Bourne shell, sh, as its abbreviation
  • The Bourne shell was the default Unix shell of Unix Version 7.
  • Most Unix-like system continue to have /bin/sh, which will be the Bourne shell, or a symbolic link or hard link to a compatible shell even when other shells are used by most users.
  • Bourne shell was developed by Stephen Bourne at Bell Labs, it was a replacement for the Thompson shell, whose executable file had the same name—sh.

C shell (csh)

  • C shell was created by Bill Joy while he was a graduate student at University of California, Berkeley in the late 1970s.
  • tcsh is its improved version.
  • What differentiated the C shell from others, especially in the 1980s, were its interactive features and overall style.
  • Its new features made it easier and faster to use. The overall style of the language looked more like C and was seen as more readable.
  • On many systems, such as Mac OS X and Red Hat Linux, csh is actually tcsh.

tcsh (improved version of C shell)

  • tcsh is based on C shell (csh).
  • It is essentially the C shell with programmable command line completion, command-line editing, and a few other features.

Korn shell (ksh)

  • KornShell was developed by David Korn at Bell Labs in the early 1980s and announced at USENIX on July 14, 1983.
  • KornShell is backward-compatible with the Bourne shell and includes many features of the C shell, inspired by the requests of Bell Labs users.

$PATH Variable

  • $PATH is an environment variable on Unix-like operation systems, DOS, OS/2, and Microsoft Windows.
  • $PATH specifies a set of directories where executable programs are located.
  • $PATH variable is specified as a list of one or more directory names separated by colon (:) characters.

  • In order to prevent the accidental execution of scripts residing in the current directory, executing such programs requires the deliberate use of a directory prefix (./) on the command name.

How to change $PATH?

Different shells have different syntaxes.

tsch / csh

bash /sh

~/.cshrc, ~/.bashrc, ~/.bash_profile

  • These are the configuration files for csh (tcsh) and bash.
  • If csh (tcsh) is the login shell, file ~/.cshrc is automatically sourced, followed by ~/.login.
  • If bash is the login shell, ~/.bash_profile will be automatically sourced, but ~/.bashrc will be ignored.
  • If bash is ran as a subshell, ~/.bashrc will be automatically sourced, but ~/.bash_profile will be ignored.
  • My preference is to use bash only.
  • ~/.bash_profile should source ~/.bashrc by adding the following code

AFS

  • Andrew File System
  • Distributed file system
  • Developed by Carnegie Mellon University as part of the Andrew Project.
  • Its primary use is in distributed computing.

Access control list (ASL)

  • An access control list (ACL), with respect to a computer file system, is a list of permissions attached to an object.
  • An ACL specifies which users or system processes are granted access to objects, as well as what operations are allowed on given objects.

One thought on “Unix Basics – Shells, Environment Variables, AFS, ASL

  1. Well it was an immensely helpful post.Thanks just for posting such an information here.I really hope you will definitely continue enlightening individuals in future also,by way of this sort of important info.Keep up the good work.

Leave a Reply

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