linux - echo the type of terminal being ran -
i'm trying echo type of current terminal being ran. instance if running konsole echo konsole. i've tried running
echo $term but prints out xterm every time. there better , more accurate way of doing this?
pstree can help.
$ pstree -s $$ init───gnome-terminal───bash───pstree the -s option shows parents of specified process.
in bash (and bourne-shell variants), $$ denotes pid of current shell.
another invocation (while running xterm returns):
$ pstree -s $$ init───xterm───bash───pstree specifying -a option makes pstree use ascii characters can parse output easily:
$ pstree -a -s $$ init---gnome-terminal---bash---pstree
Comments
Post a Comment