How To Customize Default Shell On Terminal?

How To Customize Default Shell On Terminal?
Tech News

Shell is a program that provides conventional, text-only UI for MacOS. The major of Shell function is to read commands input into a Terminal and run them.

By default, bash is the shell used as it is versatile and is quite useful. However, every Shell has its individual features and therefore, you might want to use other shells such as zsh, csh, sh, ksh and more.

Bourne: The default shell for non-root users. Abbreviation:  sh.

The Bourne Again Shell. Just as the name suggests, it is a successor of Bourne with some advanced features Abbreviation – bash.

Cshell has a syntax similar to the C programming language and therefore mostly used by programmers. Abbreviation: Csh

Korn Shell comes with collective features of the C shell, Bourne shell, and TC shell. It enables developers to create new shell commands when needed. Abbreviation: ksh/ksh93

Z-Shell is a Unix Shell that can be useful as command interpreter and interactive login shell. It is extended Bourne Shell with some features of ksh, Bash and tcsh Abbreviation zsh.

TC-Shell is Unix Shell based on C shell. It is C shell with some add-on features such as command-line editing, command-line completion Abbreviation tcsh.

If you want to know, what Shell you are running:

 $ echo $SHELL

You might see one of these

/bin/sh: You are running Bourne shell.

/bin/bash: You are running Bash shell.

/bin/ksh: You are running  Korn shell.

/bin/csh: You are running C Shell.

/bin/zsh: You are running Z shell.

/bin/tcsh: You are running TC Shell.

Also Read:-
10 Mac Terminal Commands You Should TryBeyond macOS skin, there’s a whole another world known as Mac command line. This article will describe how to use...

How To Customize Default Shell?

By default, login shell for MacOS is bash Shell. However, you can change it to a host of different shells such as /bin/csh, /bin/ksh,/bin/zsh and more. There can be many reasons for which you want to change the shell, most to access more features of the different shell.

How To Change the Login Shell?

To change the shell to the desired shell for your user account, follow these steps:

  • Go to Apple icon (located at the upper left corner), then go to System Preferences.

    How To Change the Login Shell

  • Under System Preferences, click Users & Groups.

    How To Change the Login Shell-1

  • Click the Padlock and enter your Admin password.

How To Change the Login Shell-2

How To Change the Login Shell-3

  • Right click on your name from the left side of the pane and Select Advanced Options.

How To Change the Login Shell-4

  • Beside Login Shell, Change /bin/bash to the desired shell.

    How To Change the Login Shell-5

Note: The changes will take effect on Terminal immediately, no restart required and all you need to do is quit and resume Terminal session.

If you want to change the default shell Terminal for any other user account, follow these steps:

  • Go to Terminal, then Preferences.

    change the default shell Terminal

  • On Preferences, click General.

    change the default shell Terminal-1

  • Click Shell open with->Command-> Enter the path to New shell.
Also Read:-
Mac Terminal Commands Cheat Sheet Everyone Should HaveRead this to know how to simplify your way through Mac Terminal to enhance your productivity and save your time.

How To Customize Command Prompt?

The default command line prompt provides you with the exact same information every time you launch Terminal. There are a lot of special character strings that when utilized to describe the prompt, can show interesting bits of data.

If you type echo $PS1, it will show text which is string-coded with the default settings of the shell prompt like this \h:\W \u\$

Wherein – \h- computer name of host

\W – current working directory

\u –  current user

On macOS, .bash_profile includes a variety of preferences determining how a shell can look & behave. The changes you made in  .bash_profile which only work to a shell session instead of shell scripts. To customize .bash_profile in nano, type in

nano ~/.bash_profile

To further customize, in a new line, add PS1=”….” Between quotation marks, you can put a series of characters.

For example: PS1=”\!\d\u\$”

! denotes the history number of the command

\d denotes the date in weekday/month/date format

\u denotes username

$ denotes UID

Once you input this sequence, to write new information, CTRL and O key together. To save the information in .bash_profile file, press CTRL and T key together. Close and relaunch Terminal to check the changes.

So, this is it! This is how you can customize the default shell on Terminal. If you are working on a multiple user Mac, then you need to use hostname, bash version, username and more to get information out of it!

Is this page helpful?

Sign Up for Our Newsletters

Enter your email address in the below field to subscribe to our Newsletter