My current shell is bash and I want to convert to ksh. I tried to convert through chsh or ypchsh but dont have permission to convert. So I tried to convert using .bash_profile as below

$vi .bash_profile
. ./.profile .

On reopening the putty, .bash_profile runs which changes to ksh, but the alias in .profile are not getting resolved.

  • No i dont have permission to edit the /etc/passwd – Yuva Raj May 20 at 8:12

please check following answer and use login SHELL

ksh --login


  • it worked,thanks for your solution – Yuva Raj May 20 at 14:09
  • Most Welcome :) – Gurdyal May 20 at 16:35

Obviously in your example .profile won't be sourced until you exit ksh. That's the way shell works.

I tried to do on my local machine the following:

$ cat /home/test/.profile
exec ksh

$ cat ~/.kshrc
echo "commands you need in ksh"

As profile is read only once on a login, it seems to be working. Whenever I login as a user, I've ksh as a shell. Didn't check it with tmux or screen though.

$ ps
  PID TTY          TIME CMD
 9667 pts/1    00:00:00 ksh
 9675 pts/1    00:00:00 ps

Note, that I use exec ksh over simple invoke ksh, so you'll have just ksh which replaced bash instead of ksh running as a child of bash.

In any way, I advise to ask sysadmin or whoever has the grant to update the settings in /etc/passwd to do so. It might help you to avoid unexpected issues with inheritance of some settings from bash you might not face when you directly invoke ksh.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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