I'm looking for a two row shell prompt

Hello guys,
If I remember correctly in the past I have watched a video of Jay which do Pop!_OS overview (but I could be wrong) on this tutorial I seen in a terminal fancy Linux shell (PS1) which consist of two rows, full directory path, date and seconds, probably git integration and so on. I also remember that I have checked the project in the GitHub and it looks promising and very widely used.

Unfortunately I can’t find the right article now.
Can you help me with that?
Thanks.

Jay’s prompt can be found in his Ansible configs on Github (complete with a nice Unicorn):

A little explanation to the default variables can be found here.

\t   The time, in 24-hour HH:MM:SS format. 
\j   The number of jobs currently managed by the shell. 
\h   The hostname, up to the first . (e.g. deckard) 
\w   The current working directory. 
\n   A newline. 

The tput commands sets colors using this commands instead of bash color codes.

In addition, you can construct your own if structure to show Git information (if inside a Git tree), like this:

$(if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]]; then echo -n "[$(git branch --show-current)]$(git rev-list HEAD --count):♮]"; fi)

Great job finding that, and great response!

I think that’s the longest I’ve used a bash prompt without changing it. The job count has been extremely useful to me.

1 Like

I also have my own two-row prompt, and one of the features I like the most is the user info and file and directory count inside the current directory.

This is the code (without colors):

[$(stat -c '%U' .)\302\246$PWD]$(ls -Al | grep -c '^d'):$(ls -Ap | grep -c -v /)]

And this is the result in a directory:

[am¦/home/am]14:36]

This means I always know who owns the directory, and also if I do file operations (copy, move, delete etc.), I get instant notification that it succeeds, since the count numbers change.