How to add icons to iTerm2?
The first prompt you show a picture of looks like a customized version of a powerline oh-my-zsh theme. It requires oh-my-zsh. There is also a version that supports bash, zsh, and fish. 

To use those, you need a Powerline-patched font. 

Your second screenshot comes from dracula-theme, a color scheme and prompt for lots of different editors plus oh-my-zsh. 

Personally, I would not recommend oh-my-zsh, as in my experience it was kind of slow and heavy. I created my own bash prompt using Powerline symbols, but milkbikis/powerline-shell is probably the best one to use.