Show your terminal prompt

Here is my prompt. Currently, I am using zsh because of better completion of svn. Bus occasionally I am using fish. I need to enhance the svn completion. Then I will presumably completely switch to fish.

My prompt is built by starship but I have turned off those icons which I do not need.

What I need (want) is

  • user name
  • directory name
  • git or svn status
  • time
  • if there was an error

Below some examples:

Here in an svn repository

image

The svn status is gotten by a tiny Rust program: https://github.com/manfredlotz/svnstatus

image

If I am on a remote system my user and the system name will be shown

image

If I am root the root user will be shown in red

image

The shell is indicated by either a fancy z (for zsh) as can be seen above or by a fish

image

If there was an error in the last command

image

Conclusion: not very fancy but giving me what is important to me

4 Likes

This is mine:

image

The important features:

  • Frog

I don’t use Fish, Fish is utter rubbish of a shell. Zsh and Bash are okay.

14 Likes

I am a zsh user. I have more or less the same prompt since 20+ years.

These are my criteria

  1. the prompt needs to distinguish between root and regular user
  2. the prompt needs to tell on which machine I am
  3. the prompt needs to show the current working directory

I prefer to have a 2 line prompt because then, the second line has always the same short length. I dont like a variable length when I have to type in that line which is the case with a 1 line prompt.

Bildschirmfoto vom 2023-03-27 08-08-59

Bildschirmfoto vom 2023-03-27 08-08-46

3 Likes

PS1='[\w]$ '
Of course change “$” to “#” where appropriate. :slight_smile:

One more thing

I HATE MANJARO’S DEFAULT KONSOLE PROMPT. The terminal is a serious thing IMHO. Also I’m not very keen about “prompts” that span several lines, even if I could afford those super-giant screens some of you are fond of. (end rant)

Just escape the $ character like this:

PS1='[\w]\$ '

And it will automatically choose between $ or #, whatever is appropriate.

About the thing

Yeah, I dislike multi-line prompts, too.

2 Likes

PRIORITIES!

honka_memes-128px-39

1 Like

2023-03-27_11-22

2023-03-27_11-48

starship.toml

add_newline = false
format = """
$directory\
$git_branch\
$git_status\
$character\
$cmd_duration"""

[character]
success_symbol = "[❯](green)"
error_symbol = "[❯](red)"

[directory]
format = "[$path]($style)(bold blue)[$read_only](bold #F0FF42)($read_only_style) "
truncation_length = 4
truncation_symbol = '…/'
home_symbol = "  "
read_only = "  "

[git_branch]
style = "bold #7C83FD"

[git_metrics]
disabled = false

[git_status]
ahead = " ⇡ ${count}"
diverged = "⇕ ⇡ ${ahead_count} ⇣ ${behind_count}"
behind = "⇣ ${count}"
format = '([\[$all_status$ahead_behind\]]($style) )'
style = "#ff00dd"

[cmd_duration]
disabled = false
format = "[$duration]($style) "
style = "yellow"
1 Like

prompt

3 Likes

cli
its called the default :rofl:

1 Like

I totally agree, and I like the concept!

It would be a potentially helpful topic, if you/all had posted actual config together with the show-off images :wink:
Unless you have copyrighted :copyright: your prompts.

Since the title does not limit shells…

here is by Bash prompt
echo ${PS1@Q}                                                                                                                                                                                                                       
'\[\e[0;96m\]\t\[\e[0m\]$( Terr=$? ; if [ ! $Terr = "0" ]; then echo -e " "\[\e[0\;1\;41m\] "Err:$Terr" \[\e[0m\] ; fi ) [\[\e[0;32m\]$(echo ${LOGNAME:+me})\[\e[0m\]@\[\e[0;91m\]\s\[\e[0m\]] \[\e[0m\]{\[\e[0;1;2;96m\]$(git branch 2>/dev/null | grep ^* | colrm 1 2)\[\e[0m\]}\[\e[0;92m\]\w\n\[\e[0;1;41m\] >>> \[\e[0;38;5;214m\] \$ \[\e[0m\]'
3 Likes

In my case it should be trivial to reproduce, but just in case, here it is:

#.zshrc:
PROMPT='%F{blue}%B%2~%b%f🐸 '
3 Likes

Ok.

As my prompt is a starship based prompt I have put my starship.toml to https://github.com/manfredlotz/starship.toml

2 Likes

For Bash users:

Bash Prompt Generator help you to create your customized Bash prompt whatever you like, no headache and without using any third-party program

https://scriptim.github.io/bash-prompt-generator/

Screenshot_20230327_173452

1 Like

Nothing fancy, bash user here
Screenshot-2023-03-27_10:59:22

3 Likes
[mindyour@ownbusiness ~]$

:stuck_out_tongue_closed_eyes:

2 Likes

(Show your terminal prompt - #14 by Zesko)
It could almost be done with an ordinary “bash” script or C++ program. Have to be comfortable parsing strings and know those ANSI escape codes. For most cases anyway. I’ve done stuff like that but not for a terminal prompt, LOL.

It’s not much, but it’s mine:

image

1 Like

I use that utter rubbish shell fish
Screenshot_20230328_073539

2 Likes

image

2 Likes

First time messing around with prompt
Screenshot_2023-03-28_14-11-02

1 Like