LinuxQuestions.org
Help answer threads with 0 replies.
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-02-2021, 07:15 AM   #76
igadoter
Senior Member
 
Registered: Sep 2006
Location: wroclaw, poland
Distribution: many, primary Slackware
Posts: 2,717
Blog Entries: 1

Rep: Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625

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﹩
Little funny
Code:
% pwd | tail
/media/piotr/5FB77A1F7EDC9AFB
% pwd | tail -c+23
EDC9AFB
from man tail
Quote:
-c, --bytes=[+]NUM
output the last NUM bytes; or use -c +NUM to output starting
with byte NUM of each file
 
Old 04-02-2021, 07:16 AM   #77
rhamel
Member
 
Registered: Sep 2009
Location: Caribbean
Distribution: Slackware 15.0, Proxmox 7.4-17, FreeBSD 13.2
Posts: 70

Rep: Reputation: Disabled
Smile The sun does NOT always set in the west

Quote:
Originally Posted by jefro View Post
I like Green on Black background.

To be pendantic, if one is at either of the poles, there is no west, or am I wrong again?


And certainly, in the summer above the Artic Circle, the sun may not set at all for about a month, or so I've heard, which I find fascinating, being a confirmed dweller of the Tropics myself.


So, perhaps, truth, like opinion, depends on perspective, again?


And, yes, I also prefer Green on Black background. Many years staring at a Wyse50 terminal.
 
Old 04-02-2021, 07:19 AM   #78
igadoter
Senior Member
 
Registered: Sep 2006
Location: wroclaw, poland
Distribution: many, primary Slackware
Posts: 2,717
Blog Entries: 1

Rep: Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625
Quote:
Originally Posted by rhamel View Post
That certainly is an interesting idea. How do you capture the time the previous command took to run?
To my knowledge one needs start process with command
Code:
% time pwd
/media/piotr/5FB77A1F7EDC9AFB

real	0m0.000s
user	0m0.000s
sys	0m0.000s
bash builtin - have a look at
Code:
% help
....
Edit: last command is
Code:
% echo $_

Last edited by igadoter; 04-02-2021 at 07:21 AM.
 
Old 04-02-2021, 07:52 AM   #79
demetalgimp
LQ Newbie
 
Registered: Mar 2021
Posts: 3

Rep: Reputation: Disabled
Favorite Linux prompt

Like many, I like path and maybe server name. But, some paths are excessively long, so a smart ellipsis to cut the path in half would be nice.
 
Old 04-02-2021, 08:04 AM   #80
JWJones
Senior Member
 
Registered: Jun 2009
Posts: 1,444

Rep: Reputation: 709Reputation: 709Reputation: 709Reputation: 709Reputation: 709Reputation: 709Reputation: 709
Nothing fancy:

Code:
\u@\h:\w\$
 
Old 04-02-2021, 08:35 AM   #81
woody weaver
LQ Newbie
 
Registered: Nov 2009
Location: Frederick, MD
Distribution: ubuntu
Posts: 4

Rep: Reputation: 0
green on black here as well

Yes, partly its the Wyse terminals (had one of those amber ones too, hated it) but mostly because its just easier to read.

I will often have a dozen terminals open, and its sometimes helpful to remember when the command ran, so

\D{%F %T} [\u@\h:\w]\$
 
Old 04-02-2021, 08:43 AM   #82
Cuetzpallin
Member
 
Registered: Feb 2008
Location: Monterrey, MX
Distribution: Slackware since 3.4 and love it!!!
Posts: 164

Rep: Reputation: 31
I was so acustomed to this one at home:
Code:
-> $

but after years working on several legacy hosts, VM's and now containers

I moved to this one:

Code:
echo $PS1
\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$
which result in a colored one:
Code:
cuetz@Kalli ~
$
 
Old 04-02-2021, 09:13 AM   #83
Cuetzpallin
Member
 
Registered: Feb 2008
Location: Monterrey, MX
Distribution: Slackware since 3.4 and love it!!!
Posts: 164

Rep: Reputation: 31
Quote:
Originally Posted by rhamel View Post
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?
I just read that you can configure using something like oh my bash or oh my zsh it dependes which is your flavor.

I'll give it a try too
 
Old 04-02-2021, 09:28 AM   #84
tombnyg1
LQ Newbie
 
Registered: Apr 2021
Location: Oceanside
Distribution: 20.10
Posts: 2

Rep: Reputation: Disabled
Root@
Feel the power
 
Old 04-02-2021, 09:35 AM   #85
s.verma
Member
 
Registered: Oct 2013
Distribution: Debian Sid, Gentoo, Arch, Debian
Posts: 186
Blog Entries: 4

Rep: Reputation: 25
>

Simple.
 
Old 04-02-2021, 12:16 PM   #86
Elvis1357
LQ Newbie
 
Registered: Mar 2021
Posts: 27

Rep: Reputation: Disabled
Wink

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
Only 3 weeks at it....still learning and finding new stuff everyday!
 
Old 04-02-2021, 02:23 PM   #87
The Squash
Member
 
Registered: Apr 2020
Distribution: Gentoo GNU/Linux x86 (32 bit)
Posts: 31

Rep: Reputation: Disabled
Most of the time, my distribution's default colored bash prompt. When I am dealing with long pathnames, I set my prompt to:

Code:
PS1="\W $ "
 
Old 04-02-2021, 05:35 PM   #88
NGC_7492
LQ Newbie
 
Registered: Apr 2020
Posts: 5

Rep: Reputation: Disabled
if [ $UID = 0 ]; then
PS1='Sirius \w# '
else
PS1="Sirius \w "
fi
 
Old 04-02-2021, 10:48 PM   #89
zepherusbane
LQ Newbie
 
Registered: Oct 2019
Distribution: Garuda Linux
Posts: 16
Blog Entries: 1

Rep: Reputation: 0
I use Starship to generate my prompt.

I like that I can use the same configuration on multiple machines even ones using different shells. My Linux box uses fish shell for example, while I use bash on my mac. Same prompt using same Starship.toml config file.

https://starship.rs/
 
Old 04-03-2021, 01:45 AM   #90
PaulvSchaik
LQ Newbie
 
Registered: Feb 2021
Posts: 3

Rep: Reputation: Disabled
Using a fancy zsh theme with this script:

Quote:
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"

if [[ $UID -eq 0 ]]; then
local user_host='%{$terminfo[bold]$fg[red]%}%n@%m %{$reset_color%}'
local user_symbol='#'
else
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m %{$reset_color%}'
local user_symbol='$'
fi

local current_dir='%{$terminfo[bold]$fg[blue]%}%~ %{$reset_color%}'
local git_branch='$(git_prompt_info)'
local rvm_ruby='$(ruby_prompt_info)'
local venv_prompt='$(virtualenv_prompt_info)'

ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"

PROMPT="╭─${user_host}${current_dir}${rvm_ruby}${git_branch}${venv_prompt}
╰─%B${user_symbol}%b "
RPROMPT="%B${return_code}%b"

ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"

ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹"
ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}"

ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$fg[green]%}‹"
ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="› %{$reset_color%}"
ZSH_THEME_VIRTUALENV_PREFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX
ZSH_THEME_VIRTUALENV_SUFFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX
It result is a 2 line colorful prompt with user, location and GIT info.
 
  


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