How to determine and change your shell

I decided to try out iTerm a few days ago. It’s a lovely little app and the addition of tabs is a real advantage over the Terminal, OS X’s built-in commmand line tool. Anyway, when working in iTerm I soon discovered that things weren’t quite the same (paths and aliases had vanished). Eventually I realised that iTerm was using a different shell than Terminal. It took me a wee while to hunt down the solution to a seemingly simple problem, so I thought I’d document it here for reference.

To determine which shell you are using type echo $0. This should output something like -bash (if you are using bash).

To change your shell type chsh -s bash. This would change your shell to bash. The chsh command is identical to the chpass and chfn commands that are used to alter user information. The -s flag indicates that you are changing the shell for the current user.

To view a list of shells that you can use, type pico /etc/shells

Posted 3 years ago

Commenting on this post has been disabled.

My name is Phil Lindsay, a web guy from Scotland, now living in Newcastle upon Tyne in England. I also run a web design company called Presence. You can email me at phil@xlab.co.uk, read more ramblings on my Twitter stream and view my photos on Flickr. You can grab the RSS feed for this weblog here.