How do I customize the stock terminal?

I tried installing EndeavourOS - Xfce,KDE and i3. All of them come with xfce4 terminal which I loved back when I was on manjaro. But the xfce4 terminal on my Endeavour install is absolute garbage out of the box.

The current working directory isn’t bolded or any different color;
I noticed that the terminal has a custom EndeavourOS preset (preferences->colors) but when changing to some other presets it doesn’t bold the current working directory to bold or different color. The transparency also isn’t working…

Is there any way to get my terminal to look like this for example:

p.s I am currently using the out of the box i3 version (installed a day ago).

KDE does not come with it, can’t explain how to change the terminal but someone should be able to guide you through it, I’m just too tired to explain sorry

2 Likes

https://wiki.archlinux.org/title/Bash/Prompt_customization
there are a few sites but can’t remember them, think there is a topic on here about it
https://docs.xfce.org/apps/xfce4-terminal/preferences#general
and some info on the terminal for you, theming may be set somewhere else though not too sure

1 Like

This behaviour is controlled by the PS1 variable for all terminals, xfce, KDE’s konsole, alacritty, xterm, …

Open your ~/.bashrc and put the following at the end for a change:

# when system is accessed via SSH, hostname with light grey background
if [[ $(pstree -s $$) = *sshd* ]]; then sshbg="\[\033[48;5;7m\]"; fi
# when used as root, change username to orange and '#' to red for prompt
if [ $(id -u) -eq 0 ]; then usercol="\[\033[38;5;3m\]"; hashcol="\[\033[38;5;1m\]"; else usercol="\[\033[38;5;2m\]"; fi
# bash PS1 prompt. $(realpath .) instead of \w avoids symlink paths
PS1="${usercol}\u\[$(tput sgr0)\]@\[$(tput sgr0)\]\[\033[38;5;4m\]${sshbg}\h\[$(tput sgr0)\]:\[$(tput sgr0)\]\[\033[38;5;6m\]\w\[$(tput sgr0)\]${hashcol}\\$ \[$(tput sgr0)\]"
unset sshbg rootcol hashcol

Best if you delete any other line which starts with PS1 in your current .bashrc.

4 Likes

some advice to add here back this file up just in case

2 Likes

What you presented on the second screen is the close-to-default Debian prompt, which is not present on Arch-based distros.
To change that, you need to modify your prompt in .bashrc file.

Open .bashrc in nano or other text editor and type your desired PS1 shape.
In your case that would be:
PS1='\e[1;32m\u@\h \w\$ '

for:
\e[1;32m – green colour
\u – your username
\h – your hostname
\w – your current directory
\$ – whether you’re a regular user ($) or root (#)

4 Likes

Oh yes. Please back up your file(s) before editing. A quick cp -a ~/.bashrc{,.bak} will do.

It’s easy to do a stupid mistake. I erased a directory yesterday because I typed rm instead of chmod.

2 Likes

can relate to this

1 Like

Taught me a lesson as well how quick things can go wrong.

I was doing

rm this
rm that 
rm another
rm lastthing

# and then I wanted to type chmod but my muscle memory typed `rm`

rm a-x *

# which complained about the lack of the file `a-x`, 
# but still deleted the rest.

Soo happy that I did routine backups of this directory every hour or so.

2 Likes

something I am big on now and making more than 1, always better safe than sore and sorry

2 Likes

Thank you!!!
This does the job for now. In the future I’ll my own my custom .bashrc file.
The thing I learned is that the “color” depends on your color preset in (preferences->colors) so it isn’t given explicitly; for example it’s not an R:G:B value but the equivalent of in this case “green” which changes based on your color preset.


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.