[SOLVED] X terminal emulator doesn’t read .bashrc or .profile or /etc/profile, shows ‘sh’ prompt

This is an ancient problem, but I seem to run into it frequently and even briefly forget it. When you open an X terminal emulator such as Xterm or rxvt, you might be frustrated by the fact that you can’t get a profile or startup script to run in the shell prior to displaying a prompt. Your shell prompt also defaults to something fairly useless like “sh-4.3$” instead of something more informative and fancier.

This occurs because your user account’s default shell is either not explicitly set or is set as /bin/sh rather than /bin/bash. To fix this you’ll need to run the following command as root (i.e. with su or sudo):

usermod -s /bin/bash your_user_name

You’ll need to log out and back in before the change will fully take effect; alternatively, if you’re starting X from a command prompt, you can drop out of X, export SHELL=/bin/bash, and start X again. This can also be done in your .profile or .bashrc as a workaround if you don’t have root access for some reason and don’t use a graphical login manager.

2 thoughts on “[SOLVED] X terminal emulator doesn’t read .bashrc or .profile or /etc/profile, shows ‘sh’ prompt

    1. It has been a long time since I wrote this post (over six years), so I’m not sure what to tell you. I’m sorry.

Leave a Reply

Your email address will not be published. Required fields are marked *