How can I make the terminal tab display <name of process running (vim, bash, ruby, etc)> - <parent directory/current directory>?
Asked
Active
Viewed 107 times
0
cabe56
- 101
1 Answers
0
By outputting an escape sequence you can modify the title of xterm (and many other terminal programs do this as well). E.g.:
PS1='\[\e]0;\u@\h: \w\a\]\u@\h:\w\$ '
shows username@hostname:currentdirectory as the title (and the same as prompt). Specifically the part between \e]0; and \a is used; \e is the escape character and \a is the alarm or bell character (ctrl-G). The \[ \] surrounding that is so that bash knows those bytes aren't displayed on the command line, and editing the line doesn't mess up positions.
To add the command name you could look at this post for ideas.