Customer Portal

Identify your Unix and Linux Shell


How to identify Unix shell for scripting

Most Advisable
Tips and technical articles of Oracle DBA
November, 2011   |  Oracle DBA Tips  |  Author: Kamal Raju

How to identify your Default Shell in Unix and Linux

The Bourne shell is an executable file called sh. Since it resides in the /bin directory, its full name is /bin/sh. Assuming that /bin is in your path, and you have no other program called sh in an earlier directory of your path sequence, then the Bourne shell can be invoked with sh or, with optional arguments sh args.

Similarly, the C shell is stored in the file /bin/csh and the Korn shell in /bin/ksh. There is also a /bin/rsh and /bin/bash available on many Unix and Linux versions. This is a restricted version of the Bourne shell that the system administrator may mandate in order to limit a use’s access to certain commands. The Bash is the “Bourne Again shell” and has an extended shell scripting language that includes advanced loop constructs and other neat functionality you won’t find in the standard Bourne shell. Bash often completely replaces the standard Bourne shell on newer systems. You should try ls /bin/*sh to check which shells you have on your system.

The last entry in your line of /etc/passwd will be /bin/sh if your default shell is the Bourne shell, or /bin/csh if your default is the C shell. Similarly, the Korn shell is indicated by the entry /bin/ksh. No entry after the final colon usually means that your default shell is the Bourne shell. In the /etc/passwd example, users stan and dove will default to the Bourne shell, while fred defaults to C shell.

Later on, when you start looking at shell scripts, I will point out some of the difference between these shells. Until then, simply accept the default shell that your system has provided. The differences will not affect your work significantly until you reach more advanced operations.

Since shells can be run like normal programs, you can enter the command sh, csh, or ksh to run the Bourne, C, or Korn shells, respectively. However, not that there can be differences between the way the C shell in invoked automatically during login compared with invoking it manually with a command. This default shell identification is most useful to start shell scripting for Oracle support and database support. In every remote dba work, shell scripting is essential for every database administrator to improve remote monitoring of databases.

Kamal Raju
- Oracle DBA
Back to DBA Tips Articles
Copyright Dbametrix Solutions © 2005. All Rights Reserved.
Back to page top