LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-01-2021, 11:39 PM   #61
desertcat
Member
 
Registered: Apr 2014
Location: Tucson, AZ
Distribution: UNK: (NEW Workstation) AMD 5900X w/64GB; CentOS 7 (Workstation) AMD FX 6300 w/32GB;
Posts: 74

Rep: Reputation: Disabled

I use ZSH -- sort of like BASH on steroids. There are a gazillion prompts you can use in zsh.

Here is my GoTo Prompt:

PROMPT="[%B%F{cyan}%n%f@%F{red}%m%F{green}%~%F{white}%}]%F{magenta}%}/%F{yellow}%}>%F{white}"
 
Old 04-02-2021, 12:32 AM   #62
rugbat
LQ Newbie
 
Registered: Jan 2019
Posts: 2

Rep: Reputation: Disabled
Starship

The best prompt, works in bash, zsh and fish:

https://starship.rs
 
Old 04-02-2021, 02:39 AM   #63
FrenchGuy
LQ Newbie
 
Registered: Oct 2008
Location: Toulouse, France
Distribution: Arch
Posts: 18

Rep: Reputation: 8
Under zsh, my prompt indicates the success or failure of the previous command (green check mark or red X cross), user @ host and the last component of the current path. The right part of the line contains the full path and the return code of the previous command. This right part appears only on the prompt line and disappears as needed to accommodate the command line I enter.
Forgot from which site I get the tricks but find it quite handy as I have all the information I need and the terminal stays rather 'clean'.
BTW, the user is red when root.

Jean-Pierre
 
Old 04-02-2021, 02:54 AM   #64
Tux!
Member
 
Registered: May 2011
Location: Netherlands
Distribution: openSUSE
Posts: 114

Rep: Reputation: 32
in tcsh

set prompt="$prod%{`tput smso`%}%m:%{`tput rmul;tput dim`%}%/ %h %#%{`tput sgr0`%} "

resulting is a colorful

hostname:/full/current/path 123 >

I als have

alias cwdcmd 'glob "^[]0;'${LOGNAME}'@'${HOST}':$cwd ['$$':'$tty']^G"'$

which puts the infor for each xterm in its title bar, so it is easy to pick the richt one from the taskbar
 
Old 04-02-2021, 03:16 AM   #65
Lucio Chiappetti
Member
 
Registered: Dec 2014
Location: Milan Italy
Distribution: Xubuntu OpenSuse
Posts: 54

Rep: Reputation: Disabled
set prompt = "$cwd:t \! > "
alias cd 'cd \!* ; set prompt = "$cwd:t \! > "'

(the last par of the current directory path plus the current command number e.g.
Temp 8 >

Anything else will be too long.

However all terminal windows title bars include host, user and tty number ... sort of

set a = `hostname`
set aa = `echo $a | tr . '\040'`
set bb = `tty | cut -d/ -f3-`

Host $aa[1] : user $USER on terminal $bb

I have appropriate escape sequences for (vestigial) vt300: vt200: vt100: sun-cmd: dtterm xterm: xterm-256color
This means also commands used to make remote access (rlogin telnet ssh) are aliased to repristinate the title bar when returning to the current machine after logout.

Been like that since ages (when we were still Unix)
 
Old 04-02-2021, 03:19 AM   #66
PeterGrootswagers
LQ Newbie
 
Registered: Feb 2017
Posts: 10

Rep: Reputation: Disabled
Talking keep it simple

PS1='[\u@\h \W]\$ '
 
Old 04-02-2021, 03:32 AM   #67
Bernt.Ribbum
Member
 
Registered: Aug 2011
Location: Oslo, Norway
Distribution: Ubuntu
Posts: 30

Rep: Reputation: 1
Weekday, time and CWD is perfect for me

PS1="`date +%a` \A \u@\h: \W\$ "
 
Old 04-02-2021, 04:03 AM   #68
BruceFerjulian
LQ Newbie
 
Registered: Apr 2013
Posts: 6

Rep: Reputation: Disabled
Simple

Two favorites.

1. The hostname.

PS1="`uname -n` # "

2. My username.

PS1="`whoami` # "
 
Old 04-02-2021, 05:08 AM   #69
desertcat
Member
 
Registered: Apr 2014
Location: Tucson, AZ
Distribution: UNK: (NEW Workstation) AMD 5900X w/64GB; CentOS 7 (Workstation) AMD FX 6300 w/32GB;
Posts: 74

Rep: Reputation: Disabled
Quote:
Originally Posted by FrenchGuy View Post
Under zsh, my prompt indicates the success or failure of the previous command (green check mark or red X cross), user @ host and the last component of the current path. The right part of the line contains the full path and the return code of the previous command. This right part appears only on the prompt line and disappears as needed to accommodate the command line I enter.
Forgot from which site I get the tricks but find it quite handy as I have all the information I need and the terminal stays rather 'clean'.
BTW, the user is red when root.

Jean-Pierre
You would not know which of the gazillion zsh themes that one is?? The prompt I laid out is a simple functional PATH= command though I'd like to mess with your theme. Two that I am currently play with are "fox.zsh-theme" and "gnzh.zsh-theme". A third one I am looking at is "bira.zsh-theme".

Thanks
 
Old 04-02-2021, 05:08 AM   #70
ChiefMike
LQ Newbie
 
Registered: Sep 2017
Location: Kalibo, Aklan, Philippines
Distribution: Fedora, Arch, LFS, ...
Posts: 1

Rep: Reputation: Disabled
Thumbs up


Termux — Bash with a full width dollar sign U+FF04
I like a little bit of space after the $... verses a normal $...
and a record of how long the last command took to finish ��
17:53:14 /~/files/home
﹩echo $PS1
\n\e[00;34m\]\t\e[00;32m\] /~/`(pwd|tail -c+23)`\e[00m \n﹩

Last edited by ChiefMike; 04-02-2021 at 05:13 AM.
 
Old 04-02-2021, 05:51 AM   #71
ialexand
Member
 
Registered: Apr 2021
Posts: 99

Rep: Reputation: 22
The best prompt is empty one :-)
 
Old 04-02-2021, 06:59 AM   #72
rhamel
Member
 
Registered: Sep 2009
Location: Caribbean
Distribution: Slackware 15.0, Proxmox 7.4-17, FreeBSD 13.2
Posts: 70

Rep: Reputation: Disabled
There's "slackware line art"?

Quote:
Originally Posted by skbranch3 View Post
login name host and folder, green for normal user, red for root and as of just now PROMPT_DIRTRIM=3. Also have the slackware line art in my .bashrc.

Do tell, where does one get "slackware line art", please?
 
Old 04-02-2021, 07:03 AM   #73
rhamel
Member
 
Registered: Sep 2009
Location: Caribbean
Distribution: Slackware 15.0, Proxmox 7.4-17, FreeBSD 13.2
Posts: 70

Rep: Reputation: Disabled
Output previous failed command?

Quote:
Originally Posted by FrenchGuy View Post
Under zsh, my prompt indicates the success or failure of the previous command (green check mark or red X cross), user @ host and the last component of the current path. The right part of the line contains the full path and the return code of the previous command. This right part appears only on the prompt line and disappears as needed to accommodate the command line I enter.
Forgot from which site I get the tricks but find it quite handy as I have all the information I need and the terminal stays rather 'clean'.
BTW, the user is red when root.

Jean-Pierre

That is so interesting. Do you have a screenshot? What do you mean by the "right part of the line"?

I also use the return code of the previous command in my root prompt, but never thought of displaying the previous command that failed.

Is such a thing even possible under bash, I wonder?
 
Old 04-02-2021, 07:08 AM   #74
rhamel
Member
 
Registered: Sep 2009
Location: Caribbean
Distribution: Slackware 15.0, Proxmox 7.4-17, FreeBSD 13.2
Posts: 70

Rep: Reputation: Disabled
Time of last command?

Quote:
Originally Posted by ChiefMike View Post

Termux — Bash with a full width dollar sign U+FF04
I like a little bit of space after the $... verses a normal $...
and a record of how long the last command took to finish ��
17:53:14 /~/files/home
﹩echo $PS1
\n\e[00;34m\]\t\e[00;32m\] /~/`(pwd|tail -c+23)`\e[00m \n﹩



That certainly is an interesting idea. How do you capture the time the previous command took to run?
 
Old 04-02-2021, 07:09 AM   #75
susilbehera
LQ Newbie
 
Registered: Jan 2020
Posts: 2

Rep: Reputation: Disabled
favorite Linux Prompt

Quote:
Originally Posted by jeremy View Post
The official LQ poll series continues. This time we want to know: What is your favorite Linux Prompt?

--jeremy
username@computername $
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Poll: (Without the poll) - How is Linux used in your workplace? SlowCoder General 13 09-11-2007 11:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:11 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