October 21, 2014
 
 
RSSRSS feed

The Unix Shell - Part One

Introduction and Basic Concepts

  • June 22, 1999
  • By Steve Singer
Introduction

The word Unix has traditionally brought to mind images of a mystical operating system for high-end workstations and servers that can only be accessed through a cryptic command line interface known as the Unix Shell. Linux with the help of graphical front ends like GNOME has allowed people the power of Unix without requiring them to learn a complex command line system. However, The Unix Shell still has a lot to offer. From the command prompt simple programs or scripts can be quickly constructed to automate repetitive tasks. Constructing larger and more complex programs can also be done with minimal effort. The Unix Shell is a powerful tool that can make life easier for anyone who is willing to invest a bit of time learning the basic syntax.

Basic Concepts

Running programs from the Unix command line is easy. Under normal circumstances it is a matter of typing in the name of the program you wish to run. For example, if you want to start the Pine email client, just type "pine" at a command prompt. Pine will then take control of the screen until you exit. Only programs located within directories that appear in your PATH can be run in this fashion. All of the directories that normally contain executable programs should be in the default PATH. If you want to run a program that is not in a directory that your path searches you must specify the full path + program name on the command line. For example, if you wanted to run the program hello, located in the /tmp directory you would have to type in "/tmp/hello" the command will work from any directory.

Moving Around Directories

Files in the Unix world are stored in directories. The directory structure on a Unix system is like a tree, the top of the tree is called the root directory or "/". The root directory can contain both subdirectories and files. Each subdirectory underneath root can also contain more subdirectories and files. When working in the shell your session always has a current directory. This current directory is the directory that you are "in" at any given time. When you execute commands from the shell, they will run with respect to the current directory. The command "pwd" will display the current directory, and the cd command allows you to change the current directory.

Sitemap | Contact Us