1

I use tilda as my terminal on Ubunut 14.10. The trouble I have is that I want to have the tab bar, since the titles in it are actually useful for navigation, but having username@computer:~/some/folder is irritating. So I looked around, and yes, I can change bash's title so that it doesn't display the username and computer.

But that only partially solves the problem, because even if I only have the pwd as the title, it grows really fast. And I don't need the whole path, so I was wondering if there is a way to set the maximum size of the title. So that if I'm in

/home/username/Downloads/some_unzipped_folder/subfolder/

The title is displayed as

/home/usern...folder/subfolder/

depending on how much width I set, so that I get some useful information from the title, but not have my tab bar in tilda fill up quickly.

hoodakaushal
  • 493
  • 1
  • 8
  • 24

1 Answers1

2

You can use bash variable string subsetting. For example

echo "${PWD:(-10)}"

to only show the last 10 characters. Change this value as you want. So for the bash title, set the PS1 variable (to do it permanent, put the line into ~/.bashrc). For example:

PS1="[...]$(echo ${PWD:(-5)}) $ "

Use sed for more complex pattern changing (e.g. the middle part of the path).

setempler
  • 510