← Back to Blog

Customizing Your Terminal

terminal

By Kevin Hou

2 minute read

Personalizing your Terminal environment can improve aesthetics and boost developer productivity. From setting a concise custom prompt manually in bash files, to using full frameworks such as Zsh, making your command line unique is one of the best ways to feel at home inside the development environment.

Changing Your Terminal Prompt

One common configuration change is adjusting the Terminal prompt text. Typically, a default prompt might look like:

1Computer-Name: User-Name ~ 2

If you find this layout long or distracting, you can remove specific variables. Here are the configuration steps for a traditional Bash environment:

  1. Go to your root directory.
  2. Locate the initialization file named .bash_profile. This is a hidden file, which you can find by executing $ ls -a. If it does not exist yet, step 3 will both initialize and create it.
  3. Run: $ nano .bash_profile
  4. Add the line: export PS1="\h: \w "
  5. Write the file out and terminate the editor: Control + O, Return, Control + X.
  6. Restart your Terminal emulator.

Your output should resemble:

1Computer-Name: ~ 2

To obtain the cleanest aesthetic showing only the current directory: export PS1="\W "

Which will display simply as:

1~ 2

For comprehensive lists of prompt settings, refer to this reference guide. You can review supplementary configurations for modifying terminal colors.


Upgrading to oh-my-zsh

For advanced configurations, frameworks like oh-my-zsh offer higher-level productivity features. It features direct status indicator badges for Git directories, autocomplete modules, file format highlights, and expanded plugin capabilities.

It works great when installed alongside alternative clients, such as iTerm 2 for macOS users.

Install scripts can be launched via either protocol option below:

Curl Command

1sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 2

Wget Command

1sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" 2

Themes

Theme profiles and color templates are available for inspection on the iTerm2 Color Schemes repository. Relevant settings files reside within the ./schemes/ subdirectory. You can evaluate previews of the preset collection here.