LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 01-09-2018, 01:59 AM   #1
//////
Member
 
Registered: Nov 2005
Location: Land of Linux :: Finland
Distribution: win 10 | OpenBSD 6.3 bridge | Fedora 28 | Fedora 27 Server
Posts: 347

Rep: Reputation: 128Reputation: 128
post your custom command prompts thread.


couldnt find thread like this, so i decided to post one here.
post your pretty colored or not command prompts.

mine is for ksh on openbsd 6.1 amd64
Code:
export PS1="\033[32m\u@\h\033[00m:\033[36m$\w\033[00m# "
and it looks like this :
Attached Thumbnails
Click image for larger version

Name:	prompt.png
Views:	39
Size:	31.1 KB
ID:	26704  
 
Old 01-09-2018, 07:41 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,492
Blog Entries: 15

Rep: Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463
I pretty much use the default these days.

Your post reminded about a time I did change the prompt on DOS. A coworker and I were talking about our relative computer skills and he said there was nothing I could do that he couldn't. When he left work I changed his DOS prompt to:
Barry can't find me>

I did that by creating a bat file named c1s.bat then adding c1s to his autoexec.bat. In those days almost all autoexec.bat files had "cls" in them. (Note the middle character in the bat I created was numeral "1" where as the clear screen command's middle character is letter "l".)

The next day he came into work and tried multiple things to get rid of this prompt all to no avail. I finally stopped him and told him what I'd done when he got to the point of reinstalling the OS.

Last edited by MensaWater; 01-09-2018 at 07:43 AM.
 
2 members found this post helpful.
Old 01-09-2018, 08:13 AM   #3
//////
Member
 
Registered: Nov 2005
Location: Land of Linux :: Finland
Distribution: win 10 | OpenBSD 6.3 bridge | Fedora 28 | Fedora 27 Server
Posts: 347

Original Poster
Rep: Reputation: 128Reputation: 128
i actually did create dos command prompt on my fathers 286, (i was 10+ years old then) your post reminded me about that

i like fiddling with things like command prompts etc.
 
Old 01-09-2018, 02:27 PM   #4
cynwulf
Senior Member
 
Registered: Apr 2005
Posts: 2,130
Blog Entries: 5

Rep: Reputation: 1186Reputation: 1186Reputation: 1186Reputation: 1186Reputation: 1186Reputation: 1186Reputation: 1186Reputation: 1186Reputation: 1186
In ~/.profile (for login shells)
Code:
PS1="\u@\h:\w $ "
Gives e.g.
Code:
user@hostname:/usr/src $

Last edited by cynwulf; 01-09-2018 at 02:29 PM.
 
Old 01-11-2018, 02:34 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 9,694
Blog Entries: 7

Rep: Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393
I've had this in my /etc/bash.bashrc for a long while now:
Code:
	if [[ ${EUID} == 0 ]] ; then
		color=1 # red
	else
		color=2 # green
	fi
	if [ "$TERM" != "linux" ]; then
		PS1="\[$(tput setaf $color)\]\[$(tput rev)\]  \[$(tput sgr0)\]\[$(tput setaf 5)\]\${?#0}\[$(tput setaf $color)\] \u@\h \w\[$(tput sgr0)\]\n\[$(tput rev)\]  \[$(tput sgr0)\] "
	else
		# adding \t = time to tty prompt
		PS1="\[$(tput setaf $color)\]\[$(tput rev)\]  \[$(tput sgr0)\]\[$(tput setaf 5)\]\${?#0}\[$(tput setaf $color)\] \t \u@\h \w\[$(tput sgr0)\]\n\[$(tput rev)\]  \[$(tput sgr0)\] "
	fi
	unset color
Attached Thumbnails
Click image for larger version

Name:	prompt.png
Views:	22
Size:	932 Bytes
ID:	26733  
 
Old 01-11-2018, 06:08 AM   #6
//////
Member
 
Registered: Nov 2005
Location: Land of Linux :: Finland
Distribution: win 10 | OpenBSD 6.3 bridge | Fedora 28 | Fedora 27 Server
Posts: 347

Original Poster
Rep: Reputation: 128Reputation: 128
thats vnice looking, clean compared to mine :

Code:
export PS1="\[\033[1;34m\][\$(date +%H:%M)][\[\033[1;31m\]\u\[\033[1;32m\]@\h:\[\033[1;34m\]\w]#\[\033[0m\] "
Attached Thumbnails
Click image for larger version

Name:	prompt.png
Views:	24
Size:	4.3 KB
ID:	26734  

Last edited by //////; 01-11-2018 at 06:12 AM.
 
Old 01-11-2018, 11:56 AM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 9,694
Blog Entries: 7

Rep: Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393
i forgot to mention a neat feature:
it also shows the return value of the last command, if it's larger than 0:
Attached Thumbnails
Click image for larger version

Name:	prompt2.png
Views:	17
Size:	616 Bytes
ID:	26736  
 
Old 01-11-2018, 03:43 PM   #8
cynwulf
Senior Member
 
Registered: Apr 2005
Posts: 2,130
Blog Entries: 5

Rep: Reputation: 1186Reputation: 1186Reputation: 1186Reputation: 1186Reputation: 1186Reputation: 1186Reputation: 1186Reputation: 1186Reputation: 1186
DragonFly BSD 5.0.2

~/.cshrc (tcsh prompt)
Code:
set prompt = "%N@%m:%~ %# "
The result is much the same as my OpenBSD 6.2 ksh prompt (posted above))
Code:
user@hostname:~ %
No fancy colours though...
 
  


Reply

Tags
bsd, color, colour, prompt


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I got a notice to post a thread for introduction. (I think its for newbie posters, such as myself, to learn how to post a thread) Nazri Ahmad LinuxQuestions.org Member Intro 2 10-30-2017 11:57 AM
Custom built computer POST problems! NOW Won't POST! Tezushi Linux - Hardware 5 03-19-2016 11:35 AM
Custom ZSH error prompts corp769 Programming 4 12-07-2011 10:11 AM
FREE Coloured custom command prompts!!!!! =) Hegemon Linux - General 8 01-20-2003 04:34 PM

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 03:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration