|
||||
Unix 101: Finding and Changing the ShellWhat shell am I using and how do I change it? New Unix users commonly ask these questions. In this article, you will learn how to determine the current shell and change it.
What Shell Am I Using?The Unix shell interprets commands and interacts with the base Unix system (called the kernel). For example, when you typerm *.bak at the Unix prompt, the shell finds all files whose filenames end with .bak and asks the kernel to remove them. There are several different Unix shells. To determine which shell you are using type ps at the Unix prompt. This will provide a list of processes. A process is a Unix command or program that you are currently running. The shell is a process so you will see the executable name of your shell in the process list. Depending on your system, it may be listed several times. Below is a table of common Unix shells and their executable names.
For example, using ps on my system
displays the tcsh process indicating that I am using the
The Korn,
Site Conventions - ShellsIn most Focus on Unix examples, Unix commands are shown preceded by the Unix prompt. For example,$ ls The dollar sign ($) is the prompt. It indicates the beginning of a Unix command and should not be typed. Most examples will work in any shell. In this case, the shell prompt is generically indicated by a $ (dollar sign). You will always be told when an example is shell specific. In these special cases:
What Shells are Available?Most Unix systems have more than one shell available. The file /etc/shells contains a list of all shells available on the current system. For example,
Temporarily Changing the ShellTo temporarily change shells just type the executable name of the new shell at the Unix prompt. For example, if you are a Korn shell user who wants to try the
$ csh
will start a
When you are done, type exit to return to the previous shell. For example,
to exit the
% exit
Permanently Changing the ShellMethods for permanently changing the shell vary from system to system. The first step is to determine the full path to the new shell. The path is shown in the /etc/shells file. In the above example, the full path to theOnce you have determined the full path to the new shell, the chsh, chpasswd, passwd, ypchsh or ypchpasswd command are normally used to change the default shell. Try reading your system manual page for these commands. For example,
$ man chsh
WARNING: Be careful changing your default shell. It is possible to make a mistake that only your system administrator can fix. Make sure you are changing to valid system shell and that you have tried temporarily using the shell first. Related Links
|