Bash

Change shell

Syntax#

  • echo $0
  • ps -p $$
  • echo $SHELL
  • export SHELL=/bin/bash
  • exec /bin/bash
  • cat /etc/shells

Find the current shell

There are a few ways to determine the current shell

echo $0
ps -p $$
echo $SHELL

Change the shell

To change the current bash run these commands

export SHELL=/bin/bash
exec /bin/bash

to change the bash that opens on startup edit .profile and add those lines

List available shells

To list available login shells :

cat /etc/shells

Example:

$ cat /etc/shells
# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow