This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

Shell

From Gentoo Wiki (test)
Jump to:navigation Jump to:search

A shell is a command-line interpreter that offers a text-based interface to users. It can be used as command-line interface (CLI) on a terminal emulator or as a script interpreter running in the background.

Typically the shell is the first program started after a user logs in at a terminal. The /etc/passwd file contains information on the default shell for each user on the system.

Available software

Name Package Homepage Description
bash app-shells/bash https://tiswww.case.edu/php/chet/bash/bashtop.html The Bourne Again Shell, is the default shell on Gentoo. It is used by Portage, Gentoo's default package manager.
dash app-shells/dash http://gondor.apana.org.au/~herbert/dash/ The Debian Almquist Shell, a small, fast, and posix-compliant shell suited for startup scripts (as /bin/sh replacement).
fish app-shells/fish https://fishshell.com/ The Friendly Interactive SHell.
ksh app-shells/ksh http://www.kornshell.com/ The Original Korn Shell, 1993 revision (ksh93).
mksh app-shells/mksh https://www.mirbsd.org/mksh.htm An actively developed free implementation of the Korn Shell, and well suited for scripting.
tcsh app-shells/tcsh http://www.tcsh.org/ an enhanced version of the Berkeley C Shell (csh).
xonsh dev-python/xonsh http://xon.sh/ A Python-based shell that falls back to bash commands.
zsh app-shells/zsh http://www.zsh.org/ An advanced shell that is the chosen interactive shell for many users.
Note
Many shell scripts reference the /bin/sh file; this is generally a symlink to the shell of choice.

For more shell options see the output of the following command (app-portage/eix required):

user $eix -cC app-shells

Configuration

Changing the default system shell

System administrators can change the default system shell using the eselect utility.

If it is not installed, emerge the app-eselect/eselect-sh package:

root #emerge --ask app-eselect/eselect-sh

To list possible shell options use:

root #eselect sh list

To set dash as the default system shell:

root #eselect sh set dash

Changing a user's shell

The default shell can be changed using the chsh command. To change the default shell for the current user, type chsh and enter a correct path to the new shell. In the example below, a user named Larry the cow (Larry) is changing his default shell from /bin/bash to /bin/dash:

user $chsh
Changing the login shell for larry
Enter the new value, or press ENTER for the default
	Login Shell [/bin/bash]: /bin/dash

chsh can be used by the super user account to change the default shell for any user.