SlideShare a Scribd company logo
Make the prompt great again
Jiri Tyr & Vladimir Babichev
What makes the command prompt great?
● It provides useful information
● It looks nice
● It's fast
Shell frameworks
● Bash
○ Bash Infinity
○ Bash-it
○ ...
● ZSH
○ Oh My ZSH
○ Prezto
○ ...
All written in shell = slow!
How to make it run faster?
Write it in Go!
We would like to introduce you...
GBTGBT
Make the prompt great again
GBT = Go Bullet Train
Highly configurable prompt builder for Bash and ZSH written in Go.
It's inspired by the Bullet Train theme for Oh My ZSH framework.
GBT
GBT anatomy
GBT anatomy
GBT anatomy
GBT
● 10 cars
○ Custom, Dir, ExecTime, Git, Hostname, Os, PyVirtEnv, Sign, Status, Time
● Over 200 environment variables
● Nerd fonts
● Packages for multiple platforms
○ Linux
■ RPM repo ... yum install gbt
■ DEB repo ... apt-get install gbt
■ AUR ... yaourt -S gbt
○ Mac
■ Brew ... brew install gbt
○ Android
■ Termux ... apt install gbt
GBT on Android
● Install Termux and Termux:Styling
● Select font
● Install and setup GBT
apt update
apt install gbt
PS1='$(gbt $?)'
Demo
Benchmark
cat /tmp/test.sh
BRANCH="$(git symbolic-ref HEAD)"
[ -z "$(git status --porcelain)" ] && DIRTY_ICON='%{e[38;5;2m%}✔' ||
DIRTY_ICON='%{e[38;5;1m%}✘'
[[ "$(git rev-list --count HEAD..@{upstream})" == '0' ]] && AHEAD_ICON='' || AHEAD_ICON=' ⬆'
[[ "$(git rev-list --count @{upstream}..HEAD)" == '0' ]] && BEHIND_ICON='' || BEHIND_ICON=' ⬇'
echo -en "%{e[0m%}%{e[48;5;7m%}%{e[38;5;0m%}
%{e[48;5;7m%}%{e[38;5;0m%}%{e[48;5;7m%}%{e[38;5;0m%}
%{e[48;5;7m%}%{e[38;5;0m%}${BRANCH##*/}%{e[48;5;7m%}%{e[38;5;0m%}
%{e[48;5;7m%}%{e[38;5;0m%}%{e[48;5;7m%}$DIRTY_ICON%{e[48;5;7m%}%{e[38;5;0m%}%{e[48;5;7m%
}%{e[38;5;0m%}%{e[48;5;7m%}%{e[38;5;0m%}$AHEAD_ICON%{e[48;5;7m%}%{e[38;5;0m%}%{e[48;5;7m
%}%{e[38;5;0m%}$BEHIND_ICON%{e[48;5;7m%}%{e[38;5;0m%} %{e[0m%}"
Benchmark
# Execution of the testing script by Bash
for N in $(seq 10); do time (for M in $(seq 100); do bash /tmp/test.sh 1>/dev/null 2>&1; done)
done 2>&1 | awk '{ total_cpu += $19; total_time += $21 } END { print "Avg CPU:
"total_cpu/NR"%; Avg time: "total_time/NR"s" }'
Avg CPU: 102%; Avg time: 1.9407s
# Execution of the testing script by ZSH
for N in $(seq 10); do time (for M in $(seq 100); do zsh /tmp/test.sh 1>/dev/null 2>&1; done)
done 2>&1 | awk '{ total_cpu += $19; total_time += $21 } END { print "Avg CPU:
"total_cpu/NR"%; Avg time: "total_time/NR"s" }'
Avg CPU: 103%; Avg time: 1.9079s
# Execution of GBT
for N in $(seq 10); do time (for M in $(seq 100); do GBT_SHELL='zsh' GBT_CARS='Git' gbt
1>/dev/null 2>&1; done) done 2>&1 | awk '{ total_cpu += $18; total_time += $20 } END { print
"Avg CPU: "total_cpu/NR"%; Avg time: "total_time/NR"s" }'
Avg CPU: 115%; Avg time: 1.8817s
OS Icons
Prompt forwarding
Demo
How does it work?
ssh myserver -t "
echo "PS1='$(gbt)'" > /tmp/.gbt;
bash --rcfile /tmp/.gbt;
rm -f /tmp/.gbt"
Features
● GBT executes only locally
● GBT generates a string which is then forwarded to a remote machine
● Supports forwarding of local aliases
● Integrates with SSH, Docker, Vagrant, MySQL
● Supports su and sudo
Limitations
● Works only with Bash
● Doesn’t support ExecTime, Git, PyVirtEnv cars
Contribution and support
Contribution and support
● Contribute
○ Create new themes (e.g. solarized)
○ Create new cars
■ SCM (e.g. Mercurial)
■ CPU load
■ ...
○ Optimize sequence string produced by GBT
○ Make tests running in parallel
● Spread the word
○ Thanks Gareth Rushgrove for advertising it in the next DevOps Weekly ;o)
● Star the project on Github
https://github.com/jtyr/gbt
Thank you for your attention!
Questions?

More Related Content

PPTX
Nvvp streams-3
PPTX
Comets notes
PPTX
15 map reduce on azure
PDF
GCE NFS HA
PDF
An introduction to Hubot - CloudConf 2015 - Turin Italy
PDF
Rubinius @ RubyAndRails2010
PDF
Odoo Performance Limits
ODP
Day 2-some fun coding
Nvvp streams-3
Comets notes
15 map reduce on azure
GCE NFS HA
An introduction to Hubot - CloudConf 2015 - Turin Italy
Rubinius @ RubyAndRails2010
Odoo Performance Limits
Day 2-some fun coding

What's hot (20)

PPT
Владимир Мигуро "Дао Node.js"
PPTX
От sysV к systemd
PDF
GoLang & GoatCore
PDF
Highlights of Go 1.1
PDF
Open Social Data (Jaca), Alejandro Rivero
DOCX
PPTX
Jk rubyslava 25
PDF
The Practice of Alluxio in Near Real-Time Data Platform at VIPShop [Chinese]
PDF
Highlights of Go 1.1
PPTX
Highload осень 2012 лекция 1
PDF
Odoo Online platform: architecture and challenges
PPTX
Ac cuda c_1
PDF
Gitosis on Mac OS X Server
PDF
37562259 top-consuming-process
PDF
Dicas e truques de otimização de websites python
PDF
Alluxio in MOMO
PPTX
UDPSRC GStreamer Plugin Session VIII
ODP
Hackerspace PostgreSQL Atolyesi - 3
PPT
Installation of application server 10g in red hat 4
DOCX
System ctl file that is created at time of installation
Владимир Мигуро "Дао Node.js"
От sysV к systemd
GoLang & GoatCore
Highlights of Go 1.1
Open Social Data (Jaca), Alejandro Rivero
Jk rubyslava 25
The Practice of Alluxio in Near Real-Time Data Platform at VIPShop [Chinese]
Highlights of Go 1.1
Highload осень 2012 лекция 1
Odoo Online platform: architecture and challenges
Ac cuda c_1
Gitosis on Mac OS X Server
37562259 top-consuming-process
Dicas e truques de otimização de websites python
Alluxio in MOMO
UDPSRC GStreamer Plugin Session VIII
Hackerspace PostgreSQL Atolyesi - 3
Installation of application server 10g in red hat 4
System ctl file that is created at time of installation
Ad

Similar to Make the prompt great again (20)

PDF
One-Liners to Rule Them All
PPTX
Roll your own toy unix clone os
PDF
Metasepi team meeting #7: Snatch application on tiny OS
PPT
Qt native built for raspberry zero
PPTX
A Deterministic Walk Down TigerBeetle’s main() Street
PDF
The Fairy Tale of the One Command Build Script
PDF
The hacker choice
PDF
DEF CON 23 - Phil Polstra - one device to pwn them all
PDF
PFIセミナー資料 H27.10.22
PDF
Basicsof c make and git for a hello qt application
PDF
Introduction to Docker (as presented at December 2013 Global Hackathon)
ODP
Perl - laziness, impatience, hubris, and one liners
PDF
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
PDF
DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...
PPTX
Gpu workshop cluster universe: scripting cuda
PDF
Aiding the CUDA Compiler for Fun and Profit by Joe Rowell
PDF
How to test code with mruby
PDF
Biicode OpenExpoDay
PDF
Tomáš Čorej: Configuration management & CFEngine3
ODP
Description of GRUB 2
One-Liners to Rule Them All
Roll your own toy unix clone os
Metasepi team meeting #7: Snatch application on tiny OS
Qt native built for raspberry zero
A Deterministic Walk Down TigerBeetle’s main() Street
The Fairy Tale of the One Command Build Script
The hacker choice
DEF CON 23 - Phil Polstra - one device to pwn them all
PFIセミナー資料 H27.10.22
Basicsof c make and git for a hello qt application
Introduction to Docker (as presented at December 2013 Global Hackathon)
Perl - laziness, impatience, hubris, and one liners
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...
Gpu workshop cluster universe: scripting cuda
Aiding the CUDA Compiler for Fun and Profit by Joe Rowell
How to test code with mruby
Biicode OpenExpoDay
Tomáš Čorej: Configuration management & CFEngine3
Description of GRUB 2
Ad

More from jtyr (13)

PDF
Ansible Inventory Plugins
PDF
Ansible Callback Plugins
PDF
Managing VMware VMs with Ansible
PDF
How does Ansible's agentless architecture work?
PDF
Variable precedence: Where should I put a variable?
PDF
Managing multiple environments with Ansible
PDF
Jinja2 filters
PDF
Templating in ansible
PDF
Development of Ansible modules
PDF
Best practices for ansible roles development
PDF
Overcoming problems of the standard Ansible inventory file
PDF
Automation and Ansible
PDF
LEGO IR Controller
Ansible Inventory Plugins
Ansible Callback Plugins
Managing VMware VMs with Ansible
How does Ansible's agentless architecture work?
Variable precedence: Where should I put a variable?
Managing multiple environments with Ansible
Jinja2 filters
Templating in ansible
Development of Ansible modules
Best practices for ansible roles development
Overcoming problems of the standard Ansible inventory file
Automation and Ansible
LEGO IR Controller

Recently uploaded (20)

PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
Developing a website for English-speaking practice to English as a foreign la...
PPT
What is a Computer? Input Devices /output devices
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
STKI Israel Market Study 2025 version august
PPTX
Modernising the Digital Integration Hub
PPTX
1. Introduction to Computer Programming.pptx
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PPTX
observCloud-Native Containerability and monitoring.pptx
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
project resource management chapter-09.pdf
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
NewMind AI Weekly Chronicles – August ’25 Week III
Final SEM Unit 1 for mit wpu at pune .pptx
Developing a website for English-speaking practice to English as a foreign la...
What is a Computer? Input Devices /output devices
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
DP Operators-handbook-extract for the Mautical Institute
STKI Israel Market Study 2025 version august
Modernising the Digital Integration Hub
1. Introduction to Computer Programming.pptx
A comparative study of natural language inference in Swahili using monolingua...
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
observCloud-Native Containerability and monitoring.pptx
OMC Textile Division Presentation 2021.pptx
Assigned Numbers - 2025 - Bluetooth® Document
O2C Customer Invoices to Receipt V15A.pptx
Zenith AI: Advanced Artificial Intelligence
A contest of sentiment analysis: k-nearest neighbor versus neural network
project resource management chapter-09.pdf

Make the prompt great again

  • 1. Make the prompt great again Jiri Tyr & Vladimir Babichev
  • 2. What makes the command prompt great? ● It provides useful information ● It looks nice ● It's fast
  • 3. Shell frameworks ● Bash ○ Bash Infinity ○ Bash-it ○ ... ● ZSH ○ Oh My ZSH ○ Prezto ○ ... All written in shell = slow!
  • 4. How to make it run faster?
  • 6. We would like to introduce you... GBTGBT
  • 8. GBT = Go Bullet Train Highly configurable prompt builder for Bash and ZSH written in Go. It's inspired by the Bullet Train theme for Oh My ZSH framework.
  • 9. GBT
  • 13. GBT ● 10 cars ○ Custom, Dir, ExecTime, Git, Hostname, Os, PyVirtEnv, Sign, Status, Time ● Over 200 environment variables ● Nerd fonts ● Packages for multiple platforms ○ Linux ■ RPM repo ... yum install gbt ■ DEB repo ... apt-get install gbt ■ AUR ... yaourt -S gbt ○ Mac ■ Brew ... brew install gbt ○ Android ■ Termux ... apt install gbt
  • 14. GBT on Android ● Install Termux and Termux:Styling ● Select font ● Install and setup GBT apt update apt install gbt PS1='$(gbt $?)'
  • 15. Demo
  • 16. Benchmark cat /tmp/test.sh BRANCH="$(git symbolic-ref HEAD)" [ -z "$(git status --porcelain)" ] && DIRTY_ICON='%{e[38;5;2m%}✔' || DIRTY_ICON='%{e[38;5;1m%}✘' [[ "$(git rev-list --count HEAD..@{upstream})" == '0' ]] && AHEAD_ICON='' || AHEAD_ICON=' ⬆' [[ "$(git rev-list --count @{upstream}..HEAD)" == '0' ]] && BEHIND_ICON='' || BEHIND_ICON=' ⬇' echo -en "%{e[0m%}%{e[48;5;7m%}%{e[38;5;0m%} %{e[48;5;7m%}%{e[38;5;0m%}%{e[48;5;7m%}%{e[38;5;0m%} %{e[48;5;7m%}%{e[38;5;0m%}${BRANCH##*/}%{e[48;5;7m%}%{e[38;5;0m%} %{e[48;5;7m%}%{e[38;5;0m%}%{e[48;5;7m%}$DIRTY_ICON%{e[48;5;7m%}%{e[38;5;0m%}%{e[48;5;7m% }%{e[38;5;0m%}%{e[48;5;7m%}%{e[38;5;0m%}$AHEAD_ICON%{e[48;5;7m%}%{e[38;5;0m%}%{e[48;5;7m %}%{e[38;5;0m%}$BEHIND_ICON%{e[48;5;7m%}%{e[38;5;0m%} %{e[0m%}"
  • 17. Benchmark # Execution of the testing script by Bash for N in $(seq 10); do time (for M in $(seq 100); do bash /tmp/test.sh 1>/dev/null 2>&1; done) done 2>&1 | awk '{ total_cpu += $19; total_time += $21 } END { print "Avg CPU: "total_cpu/NR"%; Avg time: "total_time/NR"s" }' Avg CPU: 102%; Avg time: 1.9407s # Execution of the testing script by ZSH for N in $(seq 10); do time (for M in $(seq 100); do zsh /tmp/test.sh 1>/dev/null 2>&1; done) done 2>&1 | awk '{ total_cpu += $19; total_time += $21 } END { print "Avg CPU: "total_cpu/NR"%; Avg time: "total_time/NR"s" }' Avg CPU: 103%; Avg time: 1.9079s # Execution of GBT for N in $(seq 10); do time (for M in $(seq 100); do GBT_SHELL='zsh' GBT_CARS='Git' gbt 1>/dev/null 2>&1; done) done 2>&1 | awk '{ total_cpu += $18; total_time += $20 } END { print "Avg CPU: "total_cpu/NR"%; Avg time: "total_time/NR"s" }' Avg CPU: 115%; Avg time: 1.8817s
  • 20. Demo
  • 21. How does it work? ssh myserver -t " echo "PS1='$(gbt)'" > /tmp/.gbt; bash --rcfile /tmp/.gbt; rm -f /tmp/.gbt"
  • 22. Features ● GBT executes only locally ● GBT generates a string which is then forwarded to a remote machine ● Supports forwarding of local aliases ● Integrates with SSH, Docker, Vagrant, MySQL ● Supports su and sudo
  • 23. Limitations ● Works only with Bash ● Doesn’t support ExecTime, Git, PyVirtEnv cars
  • 25. Contribution and support ● Contribute ○ Create new themes (e.g. solarized) ○ Create new cars ■ SCM (e.g. Mercurial) ■ CPU load ■ ... ○ Optimize sequence string produced by GBT ○ Make tests running in parallel ● Spread the word ○ Thanks Gareth Rushgrove for advertising it in the next DevOps Weekly ;o) ● Star the project on Github https://github.com/jtyr/gbt
  • 26. Thank you for your attention! Questions?