LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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: Arch Linux && OpenBSD 7.4 && Pop!_OS && Kali && Qubes-Os
Posts: 824

Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
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:	46
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,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
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: Arch Linux && OpenBSD 7.4 && Pop!_OS && Kali && Qubes-Os
Posts: 824

Original Poster
Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
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,727

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
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: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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:	23
Size:	932 Bytes
ID:	26733  
 
Old 01-11-2018, 06:08 AM   #6
//////
Member
 
Registered: Nov 2005
Location: Land of Linux :: Finland
Distribution: Arch Linux && OpenBSD 7.4 && Pop!_OS && Kali && Qubes-Os
Posts: 824

Original Poster
Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
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:	32
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: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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:	22
Size:	616 Bytes
ID:	26736  
 
Old 01-11-2018, 03:43 PM   #8
cynwulf
Senior Member
 
Registered: Apr 2005
Posts: 2,727

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
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



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 12:05 PM.

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
Open Source Consulting | Domain Registration