IT大道IT大道

首页 >  技术 > Change Shell To Bash

Change Shell To Bash

原文 https://www.cyberciti.biz/faq/how-to-change-shell-to-bash/ 2017-01-12 04:24:57 0 评论

H ow do I switch from a ksh shell to bash on Linux or Unix system? How to change shells on Unix-like system?

A shell is nothing but a command that provides a text-only user interface (also known as “command line interface”) for Linux, MacOS, and Unix-like operating systems. Bash shell read commands such as ls, date and others typed into a terminal and then run them. That is the primary function of bash shell.

itdadao

How do I fund out the default shell for a user?

Type the following command to find out the default shell for a user named vivek:

$ grep vivek /etc/passwd
vivek:x:1005:1005:,,,:/home/vivek:/bin/zsh

OR

$ ps -p $$
PID TTY TIME CMD
14314 pts/9 00:00:00 zsh

OR

$ echo $0
zsh

All of the above output indicates that the shell is zsh.

How do I see what shells are available on my system?

Type thecat command as follows:

$ cat /etc/shells

Sample outputs:

itdadao

Fig.01: How to find list of available shells on Linux or Unix or MacOS?

How do I switch to a bash or different shell?

Type the name at the command line and then press the enter key. In this example, to change from any shell to the bash, type:

bash

How to change shells on a Linux or Unix-like systems?

You can change your default shell using the chsh (“change shell” ) command as follows. The syntax is:

chsh
 chsh -s {shell-name-here}
 chsh -s {shell-name-here} {user-name-here}
 chsh -s /bin/bash
 chsh -s /bin/bash vivek

You can find full path to your shell using the following command:

type -a bash
 type -a zsh
 type -a ksh

Share this tutorial on:

Tags:bash

标签列表