Skip to content

Instantly share code, notes, and snippets.

@Lemmings19
Last active January 9, 2022 23:05
Show Gist options
  • Save Lemmings19/e2b7fb761ab9af066814eb5315d63542 to your computer and use it in GitHub Desktop.
Save Lemmings19/e2b7fb761ab9af066814eb5315d63542 to your computer and use it in GitHub Desktop.
Working Linux Terminal Prompt
# Example Prompt using this gist:
# 2022-01-09 23:00:50 user@host: ~/my-folder $
# Sets the scheme for the terminal prompt. Note that '##m' constitutes a colour code.
# Avoids several bugs, including the terminal input line-wrapping over the prompt.
# Includes the full date and time.
# In Ubuntu, add this to '~/.bashrc', then run 'source ~/.bashrc' and start a new terminal
# to apply the new prompt.
PS1='\D{%F %T} \[\033[01;32m\]\u\[\033[00m\]@\[\033[01;36m\]\h\[\033[00m\]: \[\033[01;34m\]\w\[\033[00m\] $ '
@Lemmings19
Copy link
Author

Lemmings19 commented Jan 9, 2022

Available colour codes:

  • White: 00m
  • Black: 30m
  • Red: 31m
  • Green: 32m
  • Yellow: 33m
  • Blue: 34m
  • Magenta: 35m
  • Cyan: 36m
  • White: 37m

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment