From Fedora Project Wiki

< Docs‎ | Drafts‎ | CommandLineSurvivalGuide

Revision as of 14:13, 24 May 2008 by fp-wiki>ImportUser (Imported from MoinMoin)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Stop (medium size).png THIS IS A DRAFT ONLY, FOR USE BY DOCUMENTATION WRITERS AND EDITORS. DO NOT RELY ON IT FOR ANY ADVICE UNTIL THIS NOTICE DISAPPEARS AND THE DOCUMENT IS PUBLISHED AS FINAL.

Concepts

This section presents a quick overview of the background concepts and necessary theory before delving into the details of the command line interface.

Shells

Before graphical user environments such as Gnome and KDE desktops existed, users interacted with their computers using the shell as an interface. UNIX/Linux operating systems are multi-tasking/multi-user system. Applications, programs, and commands were run on the computer using a shell. When a command is specified at the shell, the shell tries to locate it and execute it (there are more internal activities that occur but the details are elaborated in the later parts of this guide).

Typical Fedora installations are booted into the the default graphical environment mode. Use the Terminal program to perform the command line tasks. It is accessed through Applications > Accessories > Terminal, which launches the gnome-terminal program. When the terminal opens, it shows a command shell prompt, such as:

[username@hostname ~] $

The dollar sign symbol $ represents that the user is logged in to the shell as an ordinary-level user. If the user is logged in as the root user, the prompt shows a # symbol, also called the hash symbol. In this guide, these prompts are not used when demonstrating commands.

Interaction with the shell is performed by specifying commands at the command prompt. Entering Iwantcheese at the prompt and pressing the [Enter] key on renders the following output:

[username@hostname ~] $Iwantcheese
Iwantcheese: Command not found.
Note.png Case-sensitivity is preserved in Linux. While whoami is a command, WhoAmI or WHOAMI or other similar variations are not the same command.

Some of the common shell environments are:

  • Thompson shell [sh: /bin/sh] - The first original shell implemented by Ken Thompson for the Unix operating system
  • Bourne shell [sh: /bin/sh] - Revised Thompson shell developed by Stephen Bourne, still popular default in many Unix operating systems
  • C shell [csh: /bin/sh] - First developed by Bill Joy for the BSD Unix system
  • Tenex C shell [tcsh: /bin/tcsh] - an improved C shell by Ken Greer later improved by Paul Placeaway and Wilfred Sanchez. This replaced C shell in most popular Unix based OSes.
  • Korn Shell [ksh: /bin/ksh] - Developed by David Korn, combining powerful features of the C and Bourne shell
  • Bourne again shell [ bash: /bin/bash] - an improvised Bourne shell was developed for the GNU project by Brian Fox and later maintained by Chet Ramey.

While there are different types of shells, the Bourne again shell (bash) and Tcsh (tcsh) are popularly used in Linux. This guide focuses on the default bash shell.

Bourne again Shell

The bash shell is the default on most Linux distros. Its rich feature set supersedes the Bourne shells capabilites by effectively combining the potentials of both the ksh and csh. Chet Ramey also maintains an interesting FAQ at ftp://ftp.cwru.edu/pub/bash/FAQ .


The Environment

Describes that the environment plays an important part of a Linux system. Describes how environment variables are used to supply options, paths, etc., providing flexibility in the system's setup.

Directories, Files, and Executables

Point to resources on Linux file systems

Scripts

Describes that commands may be grouped in various ways to provide a "macro" series of processing.

stdout, stderr, stdin

Point to references on the 3 standard streams and their normal operation. This is a setup for the redirection and pipes topic.

Redirection and Pipes

Follows discussion of the standard streams to show that they may be piped and redirected.

Permissions

Point to resources on Linux file permissions

Bash prompt customization

Very brief overview that the prompt can be customized. This will refer to other documents for more information.