Ubuntu – Hide current working directory in terminal

bash

As a default, the terminal prompt shows something like:

user@system:/folder1/folder2/folder3/folder4$

the deeper you go into the filesystem, the less space is left for typing in commands. Can I change this to only show something like:

>

I mean, I can just type pwd to show where I am at. 😉

Best Answer

export PS1='\u@\h: '

That results in oli@bert: for my prompt.

If you really want something as minimalist as you ask for, try this:

export PS1='> '

You can attach that to the end of your ~/.bashrc file to have it persist between logins.

You can also get creative with some colours. Here's what I use on my servers:

export PS1='\[\033[0;35m\]\h\[\033[0;33m\] \w\[\033[00m\]: '

Giving (it's easier to see on a full black background):

My terminals

Glossary of acceptable characters in PS1