How To Customize Your Terminal Prompt

This is a bit of a goofy hack, but some of the options can be useful if you need a little more information on your terminal prompt. Basically, I’m using it to put a Space Invader as my command prompt.screen-shot-2016-11-07-at-10-02-38-pmThis technique is for OSX/MacOS, but it will likely work on various Linux distros as they share a common terminal shell implementation.

In Terminal, open the .bash_profile file using the nano text editor
sudo nano .bash_profile

Add a new line containing the following code:
PS1=" "

Inside the quotes, you could add nearly anything you want. There are a handful of official switches that generate specific outputs:

  • \d Current Date
  • \t Current Time
  • \h Host Name
  • # Command Number
  • \u User Name
  • \W Current Working Directory (/Folder)
  • \w Current Working Directory, Full Path (~/Desktop/Folder)

Now, if you want to drop a Space Invader inside the quotes, just add it (or any other emoji) from the Edit>Emoji & Symbols menu.

Also on:

Leave a Reply