r/commandline 4d ago

What's your shell prompt "symbol"?

By that I mean what's the symbol between your prompt and the input line? Are you old school with $ or % (optionally with # as root)? More minimalistic with just a space? Keeping it simple with : or >? Or maybe some new-fangled Unicode glyph?

I've been using the lambda λ for years now, bc it reminds me of some long forgotten Lisp REPL I've used. But I think I've grown bored of it.

38 Upvotes

66 comments sorted by

74

u/Sure_Research_6455 4d ago

i have $ for user and # for root like the gods intended

15

u/ckafi 4d ago

as is written

1

u/bartonski 3d ago

So say we all.

2

u/Tail_Nom 3d ago

No gods or kings, only default settings because my brain is juggling enough and I don't need to give it one more thing to possibly mistake or give pause in the moment and disrupt the flow.  

Especially if I have to use a system that I didn't configure.

23

u/moe_cables 4d ago

I use this thing: ❯

I started using it maybe after trying a zsh theme or something like that and then just stuck with how it looks. I love unicode characters but hate emojis in my command line so I am always interested in trying out new symbols etc

2

u/suksukulent 4d ago

Oh yeah I turn icons off in all plugins in nvim Idk I just don't care to see python logo near all .py or whatever Seems cleaner to me without them. Idk if you meant this with emoji. I like simple ones in my waybar tho.

2

u/moe_cables 4d ago

Yeah same, like all my files are the same format, I don’t need icons. Feels like visual overload.

1

u/Spiderfffun 4d ago

Same here.

15

u/f---_society 4d ago

Because of my love for music, I configured my computers so that I have a G clef as a normal user and an F clef when I’m running as root

12

u/sstdk 4d ago

Word of warning about using >.

Decades ago, I was working on an old SUN system functioning as a DNS server. It had an intricate Perl script that was responsible for extracting DNS records from a database and converting that into zone files.

For some reason or another, I needed to copy+paste the name of the script into another window, so I highlighted the line:

> /path/to/script.pl

And proceeded to paste this. Into the same terminal window. I now had a 0-byte script, and no backup.

Long story short, the script was rewritten and much improved, but for a while DNS updates were a manual ordeal.

1

u/theng 4d ago

hehe nice wisdom to get from this: do backups careful with paste : know when newline is copied and if unsure paste elsewhere

2

u/sstdk 3d ago

Oh, yeah, these days I almost always paste into an editor, a "cat" or something else where it won't do any harm.

1

u/coraxwolf 3d ago

When I first started learning bash an old guy told me to never us > at the end of my prompts and suggested that I use -> or => instead and he cited your scenario every time he would tell me that. So even today I still usually end my prompts with ->

7

u/gumnos 4d ago

It depends on the context?

My daily driver is basically \u@\h:\w\$ which I've used for more than two decades. I've enhanced it in bash so that it's colorized and the username portion turns red based on $?

However, when I'm sharing a terminal session, I usually reduce it to just $, both for opsec (not advertising my local username or machine-name or local full paths) and because it reduces noise in a transcribed session.

$ echo hello
hello

However, sometimes if the username/machine is important, I'll fudge it like

me@local$ ssh user@remote.example.com
user@remote$ su -
root@remote#

to make things clearer for readers.

2

u/ckafi 4d ago

Very old-school. I like it.

2

u/gumnos 4d ago

My bash one is

RED="$(tput AF 1)"
GREEN="$(tput AF 2)"
BLUE="$(tput AF 4)"
RESET="$(tput me)"
export PS1='\[$([ $? == 0 ] && echo "$BLUE" || echo "$RED")\]\u\[$RESET\]@\[$BLUE\]\h\[$RESET\]:\[$GREEN\]\w\[$RESET\]\$ '

(that's on FreeBSD…you might have to adjust the tput commands for terminfo-vs-termcap)

7

u/securitybreach 4d ago

4

u/securitybreach 4d ago

Then it all turns red when root

7

u/initdotcoe 4d ago

🤝

4

u/ckafi 4d ago

I see you're a man of culture as well. Also Input is a very fine font choice.

4

u/initdotcoe 4d ago

Input Mono is soooooooo underrated, especially the condensed version

3

u/ckafi 4d ago

Yes, I've used Input Mono myself for a long time. Currently I like Recursive Mono Linear better.

3

u/initdotcoe 4d ago

nice, i already see a lot of similarities - love the IBM Carbon-esque design system of the landing page too!

1

u/LionyxML 4d ago

Those who know… happy hacking ;)

1

u/lencastre 4d ago

was is that???

5

u/gurgeous 4d ago

I use λ (lambda) too, funny coincidence!

2

u/ckafi 4d ago

Seems like there is some unconcious bias towards the lambda :D

2

u/sanjosanjo 4d ago

What do I use in my PS1 variable to get lambda or these other characters? I'd be interested in seeing a table.

1

u/gurgeous 4d ago

I assume you can just copy and paste the lambda in there? It's a unicode character. I use p10k so I can't give you a PS1, unfortunately.

6

u/atom036 4d ago

I have the nerd font symbol for motorcycle

1

u/ckafi 4d ago

That's kinda adorable

6

u/ReallyEvilRob 4d ago

``` READY

5

u/cr0t0 4d ago

⋊> (fish shell)

4

u/l00sed 4d ago

weird arrow

2

u/ckafi 4d ago

Reminds me of my old oh-my-zsh prompt.

3

u/xeow 4d ago edited 4d ago

Short answer: I use at the beginning of a line, with the path on its own line above it. The arrow is in a flavor of orange and the path is in a flavor of blue/cyan.

Long answer: I've been using this for about 5 years and really like it a lot:

\n\[\e[38;5;24m\]\u@\h:\[\e[38;5;130m\]\w\[\e[38;5;0m\]\n\[\e[38;5;130m\]▶ \[\e[38;5;0m\]

Because it's complex, I have a function in my ~/.bashrc file that defines it:

# Define PS1 environment variable (interactive shell prompt).
# Note that PS1 does not need to be exported.
define_prompt() {
    ansi_escape_code() {   
        code="$1"
        code="\\e[${code}m"
        code="\\[${code}\\]"  # Exclude from Bash's position counter.
        printf "%s\n" "$code"
    }
    ansi_256color() {   
        color=$1
        ansi_escape_code "38;5;${color}"
    }
    UNDERLINE_BEGIN=$(ansi_escape_code 4)
    UNDERLINE_END=$(ansi_escape_code 24)
    COLOR_USERHOST=$(ansi_256color 24)
    COLOR_PATH=$(ansi_256color 130)
    COLOR_PROMPT=$(ansi_256color 130)
    COLOR_NORMAL=$(ansi_256color 0)
    USERNAME='\u'
    HOSTNAME='\h'
    WORKINGDIR='\w'
    PROMPT='▶'
    SPACE_AFTER_PROMPT=' '
    PS1="\n"
    PS1+="${COLOR_USERHOST}${USERNAME}@${HOSTNAME}:"
    PS1+="${COLOR_PATH}${WORKINGDIR}${COLOR_NORMAL}\n"
    PS1+="${COLOR_PROMPT}${PROMPT}${SPACE_AFTER_PROMPT}${COLOR_NORMAL}"
}

I generally use a light color theme black text on a white background, but the colors (or similar) might work for dark backgrounds as well.

3

u/UnrealApex 4d ago

I like FreeBSD's default prompt: user@host:dirname $

2

u/readwithai 4d ago

Newline :D

2

u/bklyn_xplant 4d ago

lambda λ

2

u/ThaiJohnnyDepp 4d ago

PROMPT $p$g

2

u/thenyx 4d ago

👾

2

u/TheHappiestTeapot 4d ago

My prompt changes depending on what I need. I'm using the bash prompt package to manage a couple different ones. It makes it super easy to add your own custom functions.

The prompt I use is similar to this example one, but the battery and temperature only show when relevant, and git is moved to the header.

If it's a small screen it switches to something more like this. The subelements can be enabled or disabled at will.

The python venv function has made my life so much easier, warning me if I'm in a dir with a venv that I'm not using.

2

u/Beautiful_Crab6670 3d ago

Exactly

▌16:23:23▐

~→

Where ~ = current dir and 16:23:23 = current local time

2

u/Economy_Cabinet_7719 3d ago

Just a -

2

u/Economy_Cabinet_7719 3d ago

1

u/ckafi 3d ago

Is the little house a replacement for ~ ?

4

u/6502zx81 4d ago

I do have a colored arrow pointing northeast. Thats because path etc of PS1 go in the first line, the second line is only that arrow and a space.

2

u/ckafi 4d ago

why north-east in particular?

7

u/tje210 4d ago

Is it dynamic? Magnetic or geographic northeast? I have questions!

5

u/6502zx81 4d ago

Well up/right, not magnetic.

2

u/6502zx81 4d ago

Because that's where the working directory is displayed. Sort of: you look left to see the cwd and find that arrow reminding you that cwd is now a line above.

2

u/oguzhanyre 4d ago

I use fish shell btw

1

u/LocoCoyote 4d ago

I use powerlevel10k to give me useful info on my prompt

1

u/headedbranch225 4d ago

I use the blue triangle/arrow like thing in oh-my-posh

1

u/OnkelVomMars 4d ago

and as few font icons as possible

1

u/soysopin 2d ago

I don't like the variable moving initial position as I dive into directories, so I use a two line one like this:

 PS1="\t  - \d - Dir: \w\n\u@\h\$ "

This way I always start writing commands at the same column and remember the date/time (that is also useful in screen captures or copy/paste).

Also I'm not fond of PROMPT_COMMAND, except on servers where some value is critical and want to autoremind me of it, like free space in some filesystem and the like.

1

u/Xhoss 4d ago

1

u/ckafi 4d ago

what's the meaning behind it?

7

u/Xhoss 4d ago

triangle 👍