Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to change current shell  (Read 2400 times)

0 Members and 1 Guest are viewing this topic.

Vinil

  • Guest
How to change current shell
« on: November 04, 2013, 12:56:57 am »
Its a simple process to change the current/working shell in Linux. This could be achieved by using the commands 'exec', 'chsh'.


1). Firstly know your current shell. Execute the command

# echo $0
/bin/bash


2). Check available shells

All available shells are located in the /etc/shells file. So we can check them by:-

==========
cat /etc/shells
# /etc/shells: valid login shells
/bin/csh
/bin/sh
/usr/bin/es
/usr/bin/ksh
/bin/ksh
/usr/bin/rc
/usr/bin/tcsh
/bin/tcsh
/usr/bin/esh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/screen
================

3).  To change the shell temporarily

Use exec command to change your shell temporarily as shown below.

# echo $0             ----- check current shell
/bin/bash

# exec /bin/sh     ----- change shell to sh

# echo $0            ----- verify it
/bin/sh


Note: The above change is temporary. When you relogin, you’ll go back to the original shell

4). To change the shell permanently

# chsh -s /bin/sh