Related: How to get the current terminal name?
But I only want the ID of the current terminal, e.g. when tty
returns /dev/pts/11
I only want to print 11
.
The idea is to add this information in the shell prompt after the username \u
in the PS1
variable in my .bashrc
file:
Wanted result: username11@localhost:~$
For the moment I have:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u$(tty)@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
which gives: username/dev/pts/11@localhost:~$
$(basename $(tty))
can't test, thus can't post as answer.