Some dumb questions born of frustration

Tim Chase blinux.list at
Thu Oct 27 12:51:17 UTC 2016

On October 27, 2016, Jeffery Mewtamer wrote:
> is there any way I could add a short indicator of the active
> terminal before the $? Something along the lines of tty2$ when I'm
> using tty2 and tty3$ when I'm using tty3.

You should be able to change that to

  export PS1="$(tty)$"

which would set your prompt to the full path, something like


You could trim off the leading "/dev/" with

  export PS1="$(tty | sed 's#^/dev/##')$"

which would reduce it to just


This does merely assign it once when it's evaluated in your .bashrc,
so if you use something like reptyr(1) to move your shell to another
terminal, it won't update so you'd have to re-source your .bashrc
again.  Not a big deal and not something your average user is apt to
encounter, but still something to keep in mind.


More information about the Blinux-list mailing list