Developer Forums | About Us | Site Map


Useful Lists

Web Host
site hosted by netplex

Online Manuals

Windows-to-Linux roadmap: Part 2. Console crash course
By Chris Walden - 2004-05-17 Page:  1 2 3 4 5

Which shell

One critical difference between DOS/Windows and Linux is that the command shell is a layer separated from the operating system. The shell environment affects the features you have, such as editable command lines and scrolling histories. The shell also determines the syntax required to do functions in scripts. In DOS/Windows, there was only one option for scripting, the lowly .BAT file. It did a lot, but required a good deal of creativity on the part of the script writer to do more than basic tasks. In Linux, scripts can contain loops and do more than basic conditional statements, including many things that you expect from a programming language. If you were good at writing .BAT files, shell scripts are going to let you shine.

Shell game

You can change your shell at any time by simply executing it from the console. A script can specify the shell it wants to run by putting a shebang (#!) at the top of the file pointing to the desired shell. When the script is executed, it will run in the correct shell, but leave the user's shell environment alone. Here's an example of a line to get a script to run in C shell:


The default shell is a parameter in each user account. The typical default shell in Linux is /bin/bash, though others are available. The man documentation for each shell is actually very good and goes into detail about shells and how they work. Rather than try to paraphrase that information here, select a shell from the list below and look at its man page.


The bash shell is a free version of the Bourne shell, the first Unix shell, and includes many additional features. Bash has editable command lines, a scrollable command history, and tab completion to help avoid typing long file names.


The C shell uses a "C-like" syntax and has borrowed many features from the Bourne shell, but uses a different set of internal shell commands.


The Korn shell uses the same syntax as the Bourne shell and has included the user-friendly features of the C shell. ksh is used in many installation scripts and should probably be installed on the system even if it's not your primary shell.


The TC shell is an enhanced version of the C shell and is 100% compatible with it.


The Z shell is an enhanced version of the Korn shell with many features found in the bash shell.

View Windows-to-Linux roadmap: Part 2. Console crash course Discussion

Page:  1 2 3 4 5 Next Page: Link me up, Scotty!

First published by IBM developerWorks

Copyright 2004-2024 All rights reserved.
Article copyright and all rights retained by the author.