LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to change the default shell? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-change-the-default-shell-946284/)

Ajit Gunge 05-22-2012 07:06 AM

How to change the default shell?
 
How can I change my default shell to csh.currently the shell is ksh and I want to change it to csh.If I dont have root credentials is there a way I can do this?

MensaWater 05-22-2012 07:21 AM

The shell is specified by the entry in /etc/passwd for the user and modifying default shell there requires root access.

However what you can do is REPLACE you shell with the exec commnand:

exec csh

That will replace your running shell process with csh.

That is as compared to doing just "csh" which forks out a subshell so that both bash and csh are running. When you exit a exec'ed process you exit the system. When you exit a forked process you go back to the previous shell.

To make the exec happen automatically on each login you could modify your $HOME/.bashrc or $HOME/.bash_profile to do the "exec csh".

Note that the files invoked for csh are not the same as those for bash so you might have to create your own. The global one (which you likely can't edit) is /etc/csh.cshrc and the local ones in your home are .tcshrc or .cshrc. You can override global variable settings from csh.cshrc in the .tcsrc or .cshrc as the latter get invoked after the former.


All times are GMT -5. The time now is 09:35 AM.