Questions tagged [ps1]
The ps1 tag has no usage guidance.
43
questions
0
votes
1
answer
103
views
Colored multiline PS1 losing track of where the beginning of the command is [duplicate]
my .bashrc:
export COLOR_RST=$(tput sgr0)
export COLOR_WHI=$(tput setaf 15)$(tput bold)
export COLOR_gra=$(tput setaf 7)
export COLOR_GRA=$(tput setaf 8)$(tput bold)
export COLOR_BLK=$(tput setaf 16)$(...
0
votes
1
answer
571
views
Unable to customize command prompt after installing oh-my-posh Theme on Linux CentOS
I'm using oh-my-posh theme to customize my terminal. I want to configure my command prompt adding more details but it doesn't work after installing the theme. Screenshot:
Changing the command prompt ...
1
vote
1
answer
141
views
How to hide the directory in prompt if directory has no change?
Can the prompt be hidden if the directory has no change after the last command executed? Show only the $, show the path only if the directory was changed in the last command.
My ps1:
precmd () { ...
0
votes
1
answer
756
views
Changing bash PS1 colors ruins bash command line [duplicate]
Hi I am using Fedora 37 and came across next problem.
Adding
export PS1="\e[43;39m[\t]\w\r\n[\u@\h]\\$\e[40m \[$(tput sgr0)\]"
to my .bashrc file in /home/username
in my case led up to this ...
1
vote
1
answer
234
views
My ps1 line is changed when i logout and re login?
I have this in .bash_profile
if [ -n "$TMUX" ]; then
# called inside tmux session, do tmux things
. ~/.profile
fi
# Trigger ~/.bashrc commands
. ~/.bashrc
# ------------------------...
2
votes
1
answer
2k
views
Cannot change tab label in MobaXterm
I am using MobaXterm v20.6 and WSL2+Ubuntu 20.04 from Microsoft Store. I am trying to label the tabs defining PS1 like: PS1="\e]0;\u@\h\a\w #" but tabs are still labeled as "1. WSL-...
1
vote
0
answers
148
views
Windows file content indexation via script
I just came across via the following command, but it won't enable Windows file content indexation, as you know this feature allows you to use search to look inside files and see the content of it.
So ...
1
vote
1
answer
35
views
Bash PS1 dissappears after history browsing [duplicate]
I have been configuring my new fresh Arch installation. I just finished with my PS1 in Bash and realized about an error I do not know how to solve.
This is the code:
PS1='\n\[\e[30;44m \u@\h \]\[\e[34;...
-2
votes
2
answers
1k
views
Why does this New-Item command work within powershell but not within a ps1 script?
Totally stuck here and have no idea what to do: I've got a multiple choice interactive Powershell script I'm putting together for the ops so they shave off a few minutes whenever they want to perform ...
1
vote
1
answer
1k
views
How to get the length of a prompt?
Is there a way that I can determine the length of a prompt? Is there a way that I can look at the PS1 variable and get the length from it and repeat characters for the same length?
I am trying to ...
0
votes
2
answers
95
views
PS1 Customization
Just a quick one.
Trying to modify my PS1 to show just a specific number of chracters.
Currently :
[email protected]@linuxhostname
This is because I have just intergrated some systems in my ...
1
vote
1
answer
2k
views
PowerShell does not run Script from Batch File
I am working on a batch file that can run a PowerShell script when the batch file is double clicked. I am having difficulty getting the PowerShell script to do anything when activated by the batch ...
5
votes
2
answers
2k
views
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 &...
0
votes
0
answers
288
views
How to read HDD from an IBM PS/1 model 2133
I have an IDE HDD removed from an IBM PS/1 2133.
So far I've tried plugging into an IDE-USB adapter on Windows and Linux, both show a "no media" error, although a device does show up.
How can I get ...
3
votes
1
answer
2k
views
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 ...
8
votes
2
answers
14k
views
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 -...
0
votes
1
answer
1k
views
Bash PS1 and single vs. double quotes
I'm a linux and Bash newbie and would like to ask help understanding the role of single and double quotes when assigning the PS1 env var.
I wanted to set the terminal to always show the current ...
0
votes
1
answer
1k
views
A task inside my windows task scheduler will cause my server to stop responding
I have the following AppPoolActivation.ps1 file, to call a URL :-
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$request = [System.Net.WebRequest]::Create("https://...
9
votes
3
answers
50k
views
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 = $...
-1
votes
1
answer
2k
views
NullReferenceException error in powershell
I am a newb in power-shell, i have written an script that stops process according to parameters in commandline. the problem is when i run the script in power shell it works but when i try to run it ...
0
votes
2
answers
176
views
Making PS1 prompt refreshable
I want my prompt to be changed based on an output of a certain command. and based on the command result to add a color.
example:
run the command:
cphaprob stat | grep local | awk '{ print $NF }'`
(...
0
votes
1
answer
538
views
Using \r in bash PS1
I was getting a little tired of my typeaheads in Bash from messing up the PS1. For instance, I would execute a command, like ls, and while it is running, start typing the next command, like echo, and ...
2
votes
2
answers
3k
views
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 ...
0
votes
1
answer
958
views
Bash echo color as function output in PS1
I want my PS1 to display (if i'm in a git folder) the branch, and color the branch with red if working dir is dirty, and blue if it's clean. Here is what i came up to
IBlack='\e[0;90m' # Nero
...
3
votes
1
answer
925
views
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 ...
0
votes
1
answer
178
views
How can I style the command being entered in a bash prompt?
While watching this intro video to Brunch, at about t=1:30 the command prompt being used has some very cool styles.
The part I'm interested in is how the presenter managed to colour the text being ...
1
vote
1
answer
9k
views
executing powershell scripts via command prompt - win7
I'm having trouble running a powershell script automatically. When every I call or Execute the script, I get a security prompt requesting I enter "R" to run. I have already set the execution policy to ...
0
votes
2
answers
177
views
Sending special bash characters to a custom function
I read this great article on customizing the bash prompt:
http://blog.superuser.com/2011/09/21/customizing-your-bash-command-prompt/
I also read about using 256 colors in bash:
http://www.logilab....
1
vote
3
answers
365
views
Is it possible to have environment variables in the path of the working directory : PS1?
I am on Lubuntu and I am using bash. My PS1 (in .bashrc) is :
PS1="\w> "
I like it because I need to paste the working directory all the time.
The problem is that the path is always very long and ...
1
vote
3
answers
1k
views
Colored PS1 string
Clarification: I want __foo to be executed each time the PS1 string is presented in the terminal, not when the PS1 string is constructed (hence its being in quotes). __foo contains logic that examines ...
4
votes
1
answer
2k
views
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
...
0
votes
1
answer
139
views
Prompt Customization Query - PS1='[\u@\h]\!:echo $? $ '
If in .bashrc the following reports the 'history number of the current command' (and the exit code of the last command), how can I configure it to report the 'history number of the previous command'?
...
0
votes
3
answers
5k
views
How to change the PS1 value.
I am logged in as the root of a Linux 2.6.18 machine. I changed the value of PS1 as:
export PS1="$PWD> "
It works and hardcodes the command prompt as the home directory followed by a >. Now I ...
2
votes
1
answer
944
views
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 ...
4
votes
3
answers
868
views
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?
40
votes
2
answers
12k
views
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 ...
1
vote
1
answer
376
views
PS1 problem, cmd is looping [duplicate]
I've set PS1 to the following value:
PS1="\033[0;37m[\033[1;33m\w\033[0;37m]\n\t \[[34m\]\u\033[0;37m@\[[34m\]\[[1m\]\h\[(B[m\] $"
The problem is that any command spanning more than a line loops ...
2
votes
1
answer
880
views
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 ...
1
vote
1
answer
177
views
Formatting my $PS1 to x amount of character
I'm looking for a way to force my PS1 variable to a certain number of chars.
It currently looks like:
$PS1="\W $"
and I'm trying to keep the same number of characters regardless of the length of ...
9
votes
5
answers
6k
views
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 ...
5
votes
2
answers
6k
views
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.
28
votes
9
answers
35k
views
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 ...
4
votes
1
answer
2k
views
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@...