What is a command interpreter shell?
The different shells, also known as command interpreters, are utilities, that reads commands from the terminal or from a file and presents them for the operating system to execute. Shells can have features, such as command line editor, word completion, word listing, spelling correction, history mechanism and job control.
What is the default shell in FreeBSD?
The default shells in FreeBSD are sh, that is based on Bourne, and tcsh and csh, that are based on C shell. The default shell for root in FreeBSD is csh. The default shell for a user in FreeBSD is sh. It is common, that root and users have different shells assigned to their system accounts. The reason for this is primarily preferences in relation to command line features, command prompt configuration and program script programming.
Assigning a default shell to a new user of FreeBSD.
Each user is assigned a default shell, that will be started, when the user logs into the system. In this example, the available shells are sh, csh, tsch, bash, rbash and git-shell. The default shell in this example is sh.
# adduser Username: foobar Full name: Foo Bar Login group [foobar]: Login group is foobar. Invite foobar into other groups? []: Login class [default]: Shell (sh csh tcsh bash rbash git-shell nologin) [sh]: Home directory [/home/foobar]: Home directory permissions (Leave empty for default): Use password-based authentication? [yes]: Use an empty password? (yes/no) [no]: Use a random password? (yes/no) [no]: Enter password: Enter password again: Lock out the account after creation? [no]: Username : foobar Password : ******** Full Name : Foo Bar Uid : 1337 Class : Groups : foobar Home : /home/foobar Home Mode : Shell : /bin/sh Locked : no OK? (yes/no): yes adduser: INFO: Successfully added (foobar) to the user database. Add another user? (yes/no): no
Changing command interpreter shell in FreeBSD.
A user can change the default shell with the default shell change utility chsh in FreeBSD. In the example, the shell is changed from sh to csh. If the default editor is vi, the user can press I and navigate the cursor to sh and edit the shell to csh. When done, the user can press Esc, semi-colon and W and Q to write the changes and quit the editor.
$ chsh #Changing user information for foobar. Shell: /bin/csh Full Name: Foo Bar Office Location: Office Phone: Home Phone: Other information:
The shell can also be changed with other utilities, such as pw, which is often used as root to manage local users and groups from the command line. In the following example, the user foobar uses pw to list current settings. Note, that the default prompt for a user in csh is different from sh.
% pw usershow foobar foobar:*:1337:1337::0:0:Foo Bar:/home/foobar:/bin/csh