Miscellaneous

  Home arrow Miscellaneous arrow Page 3 - The Shell and UNIX
MISCELLANEOUS

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

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

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    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

    blog comments powered by Disqus

    MISCELLANEOUS ARTICLES

    - Oracle Database XE: Indexes and Sequences
    - Modifying Tables in Oracle Database XE
    - Oracle Database XE: Tables and Constraints
    - More on Oracle Databases and Datatypes
    - Oracle Database XE Datatypes: Datetime and L...
    - Oracle Database XE Datatypes: Character and ...
    - From Databases to Datatypes
    - Firefox 3.6.6 Released with Improved Plug-in...
    - Attention Bloggers: WordPress 3.0 Now Releas...
    - Reflection in PHP 5
    - Inheritance and Other Advanced OOP Features
    - Advanced OOP Features
    - Linux from Scratch V.6.6 Review
    - Linux Gaining in Strength
    - Install Slackware on Your Old PC


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 3 - Follow our Sitemap