Page 1 of 1

Your most favourite PS1 (.bashrc related)

Posted: Tue Mar 01, 2022 11:52 am
by user1234

What's your most favourite PS1? I have got

Code: Select all

PS1="\e[1;32m\u@\H\e[0m:\e[1;34m\w\e[0m\$ "

In .bashrc which is equivalent to user@host:[output similar to pwd]$ .


Re: Your most favourite PS1 (.bashrc related)

Posted: Tue Mar 01, 2022 12:28 pm
by puppy_apprentice

Code: Select all

PS1="\[\e[1;3$((RANDOM%7))m\][\w]>\[\e[0m\]"

Changes color (almost) every time terminal is launched.


Re: Your most favourite PS1 (.bashrc related)

Posted: Tue Mar 01, 2022 1:41 pm
by user1234

@puppy_apprentice :thumbup: :thumbup:


Re: Your most favourite PS1 (.bashrc related)

Posted: Tue Mar 01, 2022 2:05 pm
by mikewalsh

@user1234 :-

Okay. Enlighten the less-well-informed amongst us, if you would?

What is a "PS1"? I always thought it referred to the Sony Playstation One..... :roll:

Mike. ;)


Re: Your most favourite PS1 (.bashrc related)

Posted: Tue Mar 01, 2022 2:29 pm
by rockedge

@mikewalsh Look at your /root/.bashrc and you will see something like :

Code: Select all

. /etc/profile

#v1.0.5 need to override TERM setting in /etc/profile...
#export TERM=xterm
# ...v2.13 removed.

#export HISTFILESIZE=2000
#export HISTCONTROL=ignoredups
#...v2.13 removed.
PS1="\[\e]2;\w\a\e[32m\]$USER\\$ \[\e[0m\]"

# enable Pkg 1.9.22 TAB completion
export PKG_TAB_COMPLETION=true
. /etc/bash_completion.d/pkg 2>/dev/null

Notice the line with PS1=, this will determine how the prompt in a terminal/console will look.

Color

Code

Black

0;30

Blue

0;34

Green

0;32

Cyan

0;36

Red

0;31

Purple

0;35

Brown

0;33

To make the color brighter replace the 0; with 1; like ->

Code

Color

Green

0;32

Bright Green

1;32


These are some more codes ->

  • \u: Display the current username

  • \h: Display the hostname

  • \W: Print the base of current working directory

  • \$: Display # (indicates root user) if the effective UID is 0, otherwise display a $


Re: Your most favourite PS1 (.bashrc related)

Posted: Tue Mar 01, 2022 4:02 pm
by user1234
mikewalsh wrote: Tue Mar 01, 2022 2:05 pm

@user1234 :-

Okay. Enlighten the less-well-informed amongst us, if you would?

What is a "PS1"? I always thought it referred to the Sony Playstation One..... :roll:

Mike. ;)

I've kept in the subject (.bashrc related) so that confusion doesn't happens, but it still does. :lol: :lol:


Re: Your most favourite PS1 (.bashrc related)

Posted: Tue Mar 01, 2022 4:43 pm
by HerrBert

PS1="\[\e]2;\w\a\]# "
shows the current working directory as window title


Re: Your most favourite PS1 (.bashrc related)

Posted: Tue Mar 01, 2022 5:10 pm
by rockedge

Code: Select all

PS1="\[\e]2;\w\a\]\\$ "
Screenshot(20).png
Screenshot(20).png (8.28 KiB) Viewed 1534 times

Re: Your most favourite PS1 (.bashrc related)

Posted: Tue Mar 01, 2022 5:31 pm
by mikewalsh

@rockedge :-

'Kayyyy.....

Except that jrb's 'lite' spin on Barry's old Quirky64 April 7.0.1 - where I've been all day - doesn't actually HAVE this "PS1" line. Which explains why I couldn't work out what you were on about.

EDIT:- Hm. I see Bionicpup64 has this:-

Code: Select all

PS1="\[\e]2;\w\a\e[34m\]$USER\\$ \[\e[0m\]"

So why not Quirky64...? Curious. Does this normally exist in every .bashrc?

(Remembering, of course, that the 'Quirkies' were BK's original 'test series' after stepping down, where he was trying out all kinds of weird & wonderful ideas. Including moving stuff to novel locations, or altering the way things actually functioned...)

(*shrug*)

Mike. ;)


Re: Your most favourite PS1 (.bashrc related)

Posted: Tue Mar 01, 2022 6:16 pm
by rockedge

@mikewalsh Go on and add it in! Should do the trick in Quirky as well


Re: Your most favourite PS1 (.bashrc related)

Posted: Tue Mar 01, 2022 6:27 pm
by williwaw

Code: Select all

PS1="\`if [ \$? = 0 ]; then echo \[\e[0m\]0\[\e[0m\]; else echo \[\e[0m\]1\[\e[0m\]; fi\` \w # "

shows present working directory and either 0 or 1 to indicate exit status of a command


Re: Your most favourite PS1 (.bashrc related)

Posted: Tue Mar 01, 2022 6:30 pm
by Grey
mikewalsh wrote: Tue Mar 01, 2022 2:05 pm

What is a "PS1"? I always thought it referred to the Sony Playstation One..... :roll:

Just spit on these all sorts of bash and forget about them :) Launch the DuckStation emulator, which perfectly emulates PSX-PS1.
My most favorite PS1 is Castlevania: Symphony of the Night :D
Parasite Eve is in second place :)


Re: Your most favourite PS1 (.bashrc related)

Posted: Tue Mar 01, 2022 6:37 pm
by Keef

You can have a play here:
https://bashrcgenerator.com/
...and save the settings if you're happy.


Re: Your most favourite PS1 (.bashrc related)

Posted: Tue Mar 01, 2022 11:26 pm
by GMBudwrench

Added @Grey line and his Fossa ascii file. Btw Grey, Resident Evil for PS is good

Down in the thread
viewtopic.php?t=1238


Re: Your most favourite PS1 (.bashrc related)

Posted: Wed Mar 02, 2022 7:13 am
by puppy_apprentice
GMBudwrench wrote: Tue Mar 01, 2022 11:26 pm

Down in the thread
viewtopic.php?t=1238

You can point directly to someone's post by copying link from post headline or that small icon before "by" word.
viewtopic.php?p=9267#p9267


Re: Your most favourite PS1 (.bashrc related)

Posted: Wed Mar 02, 2022 7:28 am
by Grey

Oftopic is getting bigger :) However, the previous two links are incorrect. Here it is. However, I wouldn't call it a PS1 :)
I'm thinking how to depict a jellyfish in Ascii. I can remember the wordplay... and depict fruit jelly and fish. But somehow I don't want to :)


Re: Your most favourite PS1 (.bashrc related)

Posted: Tue Feb 27, 2024 12:07 pm
by user1234

I was bored with my current PS1, so tried to copy the one that Kali uses (I suppose it does, though haven't used KaliLinux):

screenshot1.png
screenshot1.png (15.81 KiB) Viewed 1034 times

Here's the code:

Code: Select all

export PS1='\e[1m\e[32m╭──(\e[34m\u@\h\e[32m)-[\e[37m\w\e[32m]
╰─\e[34m\$\e[0m '

Enjoy :thumbup2: !


Re: Your most favourite PS1 (.bashrc related)

Posted: Tue Feb 27, 2024 1:41 pm
by rockedge

another one borrowed from KLV-HyprlandCE ->

Code: Select all

# Bash prompt
PS1='
\e[1;35m\u\e[0;37m@\e[2;37m\h\e[0;37m: \e[0;36m\w
\e[1;34m=> \e[m'
Screenshot(2).jpg
Screenshot(2).jpg (82.42 KiB) Viewed 1025 times