Questions tagged [ps1]
46 questions
40
votes
2 answers
Linux: coloring bash prompt will break carriage return
When I try to colorize the bash prompt like this:
export PS1="\e[0;31m[\u@\h \W]\$ \e[m "
it breaks the carriage return (instead of going to a new line when line is full, it starts in the same line and erases the input text).
If I remove the color…
Abonec
- 502
29
votes
9 answers
Right align part of prompt
I am sure that I have seen someone have a part of their prompt aligned to the right in their terminal window and then have the actual cursor start on a second line. I know that I can achieve the second line with a "\n" in the PS1, but I cannot…
Felix Andersen
- 425
9
votes
5 answers
Set $PS1 differently on local computer and in ssh session
I keep my home directory under version control, so that my basic configuration is easily available on any computer.
My bash command prompt on my local computer is a complicated, colorful thing that includes the current git repository and its state. …
Will McCutchen
- 193
9
votes
3 answers
Windows task schduler keep showing 0x41301
I have wrote the following .ps1 file:-
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$request = [System.Net.WebRequest]::Create("https://localhost/")
$response = $request.GetResponse()
$response.Close()
and I set a…
John John
- 295
8
votes
2 answers
Powershell Get-ChildItem Include\Exclude - simple script not working properly
Im trying to run the following code as a powershell script,but I cant get it to work. 1st,the following works with one -Include item but I cant seem to get it to work with multiple ones. 2nd, the -Exclude perimeter doesn't seem to work. I still get…
securityghost
- 119
6
votes
2 answers
How can I change my prompt to include box drawing Unicode characters?
How can I get a $PS1 containing box-drawing characters?
I am running bash, if it makes a difference.
Wuffers
- 19,619
5
votes
2 answers
Is there a command to get bash to print a new prompt string and redraw the current line?
Instead of waiting for slow commands to finish, I'd like to run them in the background. However, when they finish running and print to stdout, I get (where █ represents my cursor) this:
$ slowcmd &
$ cmd_output
█
There is no prompt string before…
Ari Sweedler
- 983
4
votes
1 answer
PS1 window title under PuTTY with GNU screen
I'm currently setting my PS1 title with by concatinating three variables in my .bashrc in such a way:
export TERMSERVER=`who am i | awk '{print $NF}' | tr -d ')''('`
if [ -n "$TERMSERVER" ] ; then
PS1_TITLE='\h ($MACHTYPE) - $SHELL[$SHLVL] <--…
BlakBat
- 1,279
4
votes
3 answers
Make Bash's PS1 show original directory name and not symlink?
I currently have PS1='\W' but when in a symbolic link'd directory, the prompt shows the symlink name, how can I make PS1 to show the original directory name?
Petruza
- 3,931
4
votes
1 answer
Why is my bash prompt repeating its last line twice, when I ls, or cd or issue misc commands?
My prompt is such:
PS1="\[\033[32m\]\u@myserver\n\[\033[33m\w$\033[0m\] "
So as output after I ls i see this:
jake@myserver
~/public_html$
~/public_html$
When I should only (I think) see:
jake@myserver
~/public_html$
The color commands work…
Jake
- 845
4
votes
1 answer
Limit git prompt branch name width in oh-my-zsh
I use long descriptive branch names in git, causing the prompt to take up too much space leaving less room for long paths.
I would like to limit the git plugin's branch segment to something like 15 characters which will be enough for me to keep…
Matthew
- 1,348
3
votes
1 answer
bash's command number ( \# ) equivalent in zsh
I'm looking for a character to put in my zsh's $PROMPT that would be equivalent to bash's \# (the command number of this command, according to this site). So far I've found only %h but this is not what I'm looking for, it's equivalent to \!.
shrx
- 474
2
votes
2 answers
How to insert bash scripts inside the PS1 variable
I made a custom PS1 variable, which is a tremendously confusing. Here is the one that is closest to being fully working:
PS1="\n[\e[1;31m]\u@\H[\e[35m] \@ [\e[32m] PWD: \w [\e[1;34m]This folder has \$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's:…
SOMN
- 1,191
2
votes
1 answer
How can I set `less` or `more` max lines (scrollable height) limit/boundary in linux?
(Sorry for the title. Any suggestions?)
I've set my commandline PS1 to cover 3 lines:
white space
user, server and pwd
$ or # to input
I think less (or more?) is configured to break after window's height - 1, because when I do a $ git log, the…
Rudie
- 769
2
votes
1 answer
What prompt is sh using when you type sh into Terminal?
When using the default PS1 prompt that MAC OS/Terminal comes with, when you type sh you get a new style prompt.
station-4:~ user$ sh
sh-3.2$
When you export your own PS1, this functionality goes away. You type sh and you still get the PS1 prompt…
Igorio
- 778