When I open a terminal (e.g. lxsession or xterm) in LXDE which is running in a VNC session the shell is

$ echo $SHELL

However, I want my default shell which is /bin/bash to use my .bashrc file.

How can I get it?

The problem seems related to the fact that I start VNC at boot time via my crontab entry

@reboot vncserver &

If I start another VNC session from a shell I have a Bash shell as expected in this VNC session. Of course at login via SSH I get a Bash, too.

  • Please add the output of ls -hl /bin/bash to your question.
    – user46953
    Jan 13, 2017 at 17:20
  • pi@raspberrypi:~ $ ls -hl /bin/bash -rwxr-xr-x 1 root root 844K Oct 18 2014 /bin/bash Jan 14, 2017 at 12:28

3 Answers 3


It seems like the problem originates form cron using /bin/sh and not the users SHELL default. I found other people having the same problem at

As a result /bin/sh is the default SHELL when VNC is started by cron.

My solution is to start my vncserver by cron through a script in which I export the SHELL variable first like this:

export SHELL=/bin/bash

This solves the problem.


AFAIK the default login shell is used even in lxterminal.

You can check what your default is by looking at the /etc/passwd file for you user e.g. cat /etc/passwd | grep pi for most Pi users.

If you wish to change your login shell use the chsh command.

NOTE /bin/sh is a symlink to the default system shell; normally /etc/dash and should not be changed

  • My default shell is already /bin/bash. But when I open a terminal in a VNC session, I just get /bin/sh. Jan 13, 2017 at 15:49

I was able to fix the issue by adding following line in my ~/.vnc/xstartup :

export SHELL=/bin/bash

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.