All Questions
22 questions
0
votes
1
answer
744
views
how to create an alias which changes the bash prompt?
How can I make an alias along the lines of:
command-line bash bashrc prompt ps1
alias=PS1="\d \h $ "
which, obviously, won't work. Is there some trick to making assignments from the ....
18
votes
2
answers
10k
views
How can I use the arrow sign in my bash prompt?
How can I use these red and green arrow signs in the bash prompt?
update 1
This is my .bashrc file
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\...
1
vote
1
answer
593
views
Cannot export PS1 over SSH
Trying to customize shell prompt on a Ubuntu 18 LTS server over SSH.
On the server, the .profile sources .bashrc correctly, and .bashrc has force_color_prompt=yes uncommented. The prompt is not ...
0
votes
1
answer
564
views
New user, broken bash prompt parsing?
I created a new user. When I su into the new user, I get the following bash prompt:
\[\e]0;\u@\h: \w\a\]\u@\h:\w$
For what it's worth, I created this user with the following Ansible task:
user:
...
6
votes
3
answers
9k
views
script to show git branch in bash no longer works on ubuntu 18.04
In my 16.04 installation I put this in my ~/.bashrc file:
#Show git branch in commandline
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1=...
253
votes
7
answers
447k
views
Why does "(base)" appear in front of my terminal prompt?
I'm wondering why I have (base) on the left of my terminal prompt.
If I run source ~/.profile in the terminal, it disappears.
If I close that terminal and reopen a new terminal, (base) is there ...
-1
votes
1
answer
1k
views
No line break with colored git branch in bash prompt [duplicate]
I added a function to my .bashrc to parse the git branch I'm currently working in and display it in my bash-prompt according to several tutorials on this topic.
My code snippet looks like this:
...
1
vote
1
answer
2k
views
Cannot get colored prompt despite setting PS1 in .bashrc
One of the machines I log into via ssh doesn't give me a colored prompt, despite setting it via .bashrc. The .bashrc part in question is
# set a fancy prompt (non-color, unless we know we "want" ...
5
votes
1
answer
59k
views
"export PS1=" for customizing shell prompt
I wanted to customize my shell prompt to include the time. So, I did export PS1='\t\w\$'.
My prompt now looks like 18:57:37~$. I don't know how to prepend it with username@hostname.
Also, I don't ...
5
votes
2
answers
997
views
Shell prompt customization and cmd behavior
I want my prompt to display:
current (absolute) working directory, colored in green and
in a NEW line, the dollar sign and an empty space.
I am using this line in .profile
export PS1='\e[0;32m$(pwd)...
1
vote
1
answer
193
views
Gnome-terminal prompt does not clear up fully
I am running ubuntu 16.04 LTS and gnome-terminal within unity.
Sometimes when I clear my terminal the command line isn't cleared up fully. Some bit of the command left and I can't remove them. I ...
27
votes
2
answers
8k
views
Why is my function not re-evaluated in PS1?
I'm trying to have a part of my prompt set dynamically by a function, so in my .bashrc I have:
asdf ()
{
echo -n $(pwd)
}
PS1="\u@\h:\w $(asdf)\$ "
Opening a shell gives me what I expect at ...
2
votes
2
answers
419
views
Is it possible to modify the prompt according to the existence of a VPN connection?
When away from home, I like to connect to the internet via VPN. It would be great to see whether the connection is on in my prompt, for example:
frank@mycomputer ~ # without vpn active
frank@...
153
votes
4
answers
57k
views
What does "${debian_chroot:+($debian_chroot)}" do in my terminal prompt?
In my terminal prompt definition in my .bashrc file, among other things, I have this snippet of code:
${debian_chroot:+($debian_chroot)}
What does this do, and do I need it?
6
votes
1
answer
8k
views
Creating new user, inconsistent bash prompt
I've created a new user profile with:
useradd kitty
passwd kitty
mkdir kitty
chmod 0700 kitty
chown -R kitty:kitty
adduser kitty sudo
#when I did it I initially didn't ...
20
votes
5
answers
46k
views
Changing behavior of bash prompt when functioning as root
Before you click away, this isn't the typical "how do I make my bash prompt have color" question. I've already customized my bash prompt to look like this:
[user @ host]----[$(pwd)]
$
where ...
7
votes
4
answers
8k
views
How can I shorten the bash prompt's current path to one letter per directory?
I can't remember where, but I've already seen the bash prompt's current path shortened in an interesting way: every directory contained in the path (excepted the last one) is replaced by its first ...
3
votes
1
answer
263
views
.bashrc not responding
I'm having an odd problem with the .bashrc file.
I've added the following line so git could show me the current branch on prompt (I saw this tip here)
#Show branch in status line
PS1='[\W$(__git_ps1 ...
239
votes
6
answers
280k
views
How can I shorten my command line (bash) prompt?
Currently it is:
michael@Castle2012-Ubuntu-laptop01:~/Dropnot/webs/rails_v3/linker/spec/controllers$
Outside of renaming my machine and directory structure...
How could I make it be something more ...
2
votes
1
answer
2k
views
~/.bashrc changes have no effect?
I have been trying to set some custom colors on the user@hostname:~$ on the terminal. I edited both ~/.bashrc and /etc/bash.bashrc
Where it said:
debian_chroot:+($debian_chroot...
I just changed it ...
141
votes
5
answers
214k
views
Changing colors for user, host, directory information in terminal command prompt
Is it possible to change the colors in the command prompt for the user@computer, as well as the the current directory and command parts of the prompt display?
I've already seen something like this ...
20
votes
5
answers
13k
views
How (and where) can one change 'user@host $:' pattern in gnome-terminal?
When I start terminal in Ubuntu, I see:
ilya@HOST:~$
I need to add a timestamp to this, something like:
2011-10-09T09:32:00 ilya@HOST:~$
How can I configure this?