Miscellaneous
  Home arrow Miscellaneous arrow Page 3 - The Shell and UNIX
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MISCELLANEOUS

The Shell and UNIX
By: Gabor Bernat
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2009-04-08

    Table of Contents:
  • The Shell and UNIX
  • Shell Programs
  • Shell Commands
  • Command execution

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    The Shell and UNIX - Shell Commands


    (Page 3 of 4 )

     

    When the shell gets a command, it will try to search for it in the following categories.

    Commands that are used very often are built into the shell. Commands like this are pwd, history, test, echo and etcetera. These exist also in binary form inside the /bin folder; however, unless explicitly asked for, they will not be used.  

    This will speed up their execution a little. After this, the shell will search between the functions. For a task that we use multiple times, we can define a function inside the shell. We will discuss this later on.

    External commands are the third category of command. This are the commands that can be found somewhere in the file system. Of course, the shell will not search in all the folders, just a couple determined inside the PATH environment variable. 

    The final and fourth category is aliases. The aliases replace the names for a command. This helps us to replace a long command line with a shorter one. To assign a new alias, we will use the alias command with the following syntax: 

    alias [name of the alias]='[whit what]'

    When there is an alias and a command name, the aliases have priority. A general example for this is an alias that is already active on most of the UNIX systems. It is about the colorful text of the file list. You probably noticed that if you use ls, files will be colored based on their traits. This is because the following alias is automatically made: 

    alias ls='ls -color=tty'

    As you can see, the alias assigns a name to a string. The shell will replace, on the command line, the command name with this assigned string. If we use the alias command with no arguments, it will print back the already-set aliases. We can use the unalias to unset aliases. For example for the upper one the unset command is: 

    unalias ls

    If you want to read the help files for a command/tool, you can search for them in two places. If the command is built into the shell, you can find the files with the help command; if it is a tool that exists in a binary file, there will be a man (manual) file for it. You can call this with the man command. You can exit from this help by pressing Q in the terminal. 

    #the help file of the shell

    help echo

     

    #the help file of the binary command

    man echo

    More Miscellaneous Articles
    More By Gabor Bernat


     

    MISCELLANEOUS ARTICLES

    - Using PHP to Stream MP3 Files and Prevent Il...
    - 10 Must Have Firefox Improvements
    - All About OpenOffice 3.0
    - Shell Script Writing
    - Loops in the UNIX Shell
    - The Test in the UNIX Shell
    - Data Streams and the UNIX Shell
    - Control Mechanisms of the UNIX Shell
    - Variables Within the UNIX Shell
    - The Shell and UNIX
    - In Detail: UNIX File Systems
    - Rights Management in UNIX
    - UNIX File Systems
    - The Terminal in UNIX
    - Operating Systems and UNIX





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek