Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [ps1]

The tag has no usage guidance.

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?
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 ...
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 ...
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 () { ...
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 ...
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 ...
user avatar
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
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 # ------------------------...
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 ...

15 30 50 per page