Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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)
Distribution: UNK: (NEW Workstation) AMD 5900X w/64GB; CentOS 7 (Workstation) AMD FX 6300 w/32GB;
Posts: 74
Rep:
Quote:
Originally Posted by FrenchGuy
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".
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﹩
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?
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?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.