How do I check which terminal I am using?How to check which shell am I using?Why is a virtual terminal “virtual”, and what/why/where is the “real” terminal?What is the point of sh being linked to dash?Gnome-terminal vs Ubuntu-terminal differences?How to start an application from the terminal?What is the command to minimize the gnome terminal?Command to open new terminal window from the current terminal?How to check which shell am I using?How to install simplegui using terminal?how can I close this dropdown terminal?Open already running program via terminalCheck from which directory the program was executedHow I will check that the mongodb service is runing or not using terminal command?How to know which terminal window is running which process

What's the difference between 'rename' and 'mv'?

Is "remove commented out code" correct English?

How do conventional missiles fly?

Blender 2.8 I can't see vertices, edges or faces in edit mode

Emailing HOD to enhance faculty application

Arrow those variables!

Facing a paradox: Earnshaw's theorem in one dimension

Neighboring nodes in the network

1960's book about a plague that kills all white people

How can I make my BBEG immortal short of making them a Lich or Vampire?

Assassin's bullet with mercury

What's the point of deactivating Num Lock on login screens?

Will google still index a page if I use a $_SESSION variable?

Would Slavery Reparations be considered Bills of Attainder and hence Illegal?

What exploit are these user agents trying to use?

What killed these X2 caps?

Is Lorentz symmetry broken if SUSY is broken?

Fully-Firstable Anagram Sets

How to draw the figure with four pentagons?

Took a trip to a parallel universe, need help deciphering

What is the word for reserving something for yourself before others do?

Why does Arabsat 6A need a Falcon Heavy to launch

Why is the 'in' operator throwing an error with a string literal instead of logging false?

Can I ask the recruiters in my resume to put the reason why I am rejected?



How do I check which terminal I am using?


How to check which shell am I using?Why is a virtual terminal “virtual”, and what/why/where is the “real” terminal?What is the point of sh being linked to dash?Gnome-terminal vs Ubuntu-terminal differences?How to start an application from the terminal?What is the command to minimize the gnome terminal?Command to open new terminal window from the current terminal?How to check which shell am I using?How to install simplegui using terminal?how can I close this dropdown terminal?Open already running program via terminalCheck from which directory the program was executedHow I will check that the mongodb service is runing or not using terminal command?How to know which terminal window is running which process






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








17















I have Ubuntu on my machine and I am running awesome window manager on top of it. How do I check which terminal I am running? Is there a command for it?










share|improve this question



















  • 3





    what do you mean by which? Click Help --> About is that it?

    – JoKeR
    Jun 23 '15 at 19:34







  • 3





    Which terminal meaning the terminal program or the shell ?

    – heemayl
    Jun 23 '15 at 19:37

















17















I have Ubuntu on my machine and I am running awesome window manager on top of it. How do I check which terminal I am running? Is there a command for it?










share|improve this question



















  • 3





    what do you mean by which? Click Help --> About is that it?

    – JoKeR
    Jun 23 '15 at 19:34







  • 3





    Which terminal meaning the terminal program or the shell ?

    – heemayl
    Jun 23 '15 at 19:37













17












17








17


2






I have Ubuntu on my machine and I am running awesome window manager on top of it. How do I check which terminal I am running? Is there a command for it?










share|improve this question
















I have Ubuntu on my machine and I am running awesome window manager on top of it. How do I check which terminal I am running? Is there a command for it?







command-line gnome-terminal






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 24 '15 at 8:56









heemayl

67.8k11142214




67.8k11142214










asked Jun 23 '15 at 19:26









user4943481user4943481

89113




89113







  • 3





    what do you mean by which? Click Help --> About is that it?

    – JoKeR
    Jun 23 '15 at 19:34







  • 3





    Which terminal meaning the terminal program or the shell ?

    – heemayl
    Jun 23 '15 at 19:37












  • 3





    what do you mean by which? Click Help --> About is that it?

    – JoKeR
    Jun 23 '15 at 19:34







  • 3





    Which terminal meaning the terminal program or the shell ?

    – heemayl
    Jun 23 '15 at 19:37







3




3





what do you mean by which? Click Help --> About is that it?

– JoKeR
Jun 23 '15 at 19:34






what do you mean by which? Click Help --> About is that it?

– JoKeR
Jun 23 '15 at 19:34





3




3





Which terminal meaning the terminal program or the shell ?

– heemayl
Jun 23 '15 at 19:37





Which terminal meaning the terminal program or the shell ?

– heemayl
Jun 23 '15 at 19:37










7 Answers
7






active

oldest

votes


















13














TL;DR



  • to find currently running shell use ls -l /proc/$$/exe

  • to find currently running terminal, use xprop _NET_WM_PID WM_CLASS. The value of pid later can be passed to ps -p <pid> -o args command.


  • Technically, for terminal emulator you don't even need a command, as stated in the comments:




    what do you mean by which? Click Help --> About is that it? – JoKeR




Shell vs Terminal



First thing we need to have clarified is what exactly is being asked - find out the running shell or running terminal. Often these two terms are used interchangeably, but they are different things altogether. Shell is the command-line interpreter, specifically interactive shell is the prompt plus text field where you enter commands. Shells can also be non-interactive, for example a script starts non-interactive shell, or bash -c 'echo hello world' also starts non-interactive shell.



By contrast, terminal is the interface to shell ( though it could be another application as well). Originally terminal referred to actual hardware, but nowadays they're mostly software. What you see when you press Ctrl+Alt+t or click on the terminal icon in GUI, that starts a terminal emulator, a window which mimics behavior of hardware, and within that window you can see the shell running. Ctrl+Alt+F2 (or any of the 6 function keys) will open virtual console, aka tty. I recommend reading Why is a virtual terminal “virtual”, and what/why/where is the “real” terminal? for more info on the specifics.



Getting the shell information



Each user has a default shell assigned to them in /etc/passwd for their username. Assuming you are using default configuration and haven't called another shell explicitly as a command, it is sufficient to do:



echo $SHELL


But of course this only shows default value. Suppose we do the following:



user@ubuntu:~$ dash
$


We were originally in bash, but started interactive session of /bin/dash, Ubuntu's POSIX or system shell. The variable $SHELL won't change, because that's not its purpose - it shows default not current value. We will need to approach this from another perspective - the perspective of a process, which is something I've covered in Am I using bash or sh?



$ echo $$
4824
$ cat /proc/4824/comm
mksh
$ bash
xieerqi@eagle:~$ echo $$
6197
xieerqi@eagle:~$ cat /proc/6197/comm
bash


Here we take advantage of /proc/ filesystem. The name of the process and command-line parameters are displayed in /proc/<pid>/comm. All we need is to provide shell's PID, which is what $$ does. In the example above I am adding that separately, but there is nothing stopping us from doing just



cat /proc/$$/comm


Variation on the theme could also be



ps -p $$ -o args


Another way we could approach this is via checking where /proc/<pid>/exe. This file is a symlink that points to the executable file. Thus we can do



user@ubuntu:~$ ls -l /proc/$$/exe
lrwxrwxrwx 1 adminx adminx 0 Apr 4 18:20 /proc/1241/exe -> /bin/bash
user@ubuntu:~$ sh
$ ls -l /proc/$$/exe
lrwxrwxrwx 1 adminx adminx 0 Apr 4 18:20 /proc/1255/exe -> /bin/dash


Either of the two approaches works in 99% of the cases. Of course, there are ways in which they can be subverted. For instance, symlink won't point anywhere if the executable was deleted shortly after the shell started ( and in that case you probably will encounter system issues, since removing /bin/sh, /bin/dash, or even /bin/bash is not recommended - after all a lot of scripts rely on them, especially system-level ones). Command name for shell is usually set as the very first argument in execve() syscall. This is covered in How does bash know how it is being invoked? , so if you have an application that launches a shell via execve(), it could give it any name. But these are non-standard and non-typical things, that should be avoided for the sake of consistency and security.




Getting Terminal Information



We can start with the environment variables. Many terminals seem to mask themselves as xterm-compatible, which is reported by echo $TERM or echo $COLORTERM. But then environment variables are not very reliable tool. They can be set and unset. We can do the same thing with PIDs again, except this time we will look at parent PID. As you may remember, terminal is the interface to the shell and often starts the shell itself. Therefore we can find out what process is the parent process of our shell:



$ ps -p $$ -o args,ppid
COMMAND PPID
bash 1234
$ ps -p 1234 -o args
COMMAND
/usr/lib/gnome-terminal/gnome-terminal-server


Let's try with another terminal app, sakura:



$ ps -p $$ -o args,ppid
COMMAND PPID
/bin/bash 16950
$ ps -p 16950 -o args
COMMAND
sakura


From there we can already see that what started this shell is gnome-terminal. This method of course works assuming you're working with interactive shell. If we're trying to find out the parent of bash -c '...' or the shell started via ssh, for example, PID may very well be from non-terminal application and maybe non-GUI at all.



So if we want to specifically deal with GUI terminal, what we can do is run xprop, click on the desired window, grep its pid, and find out what's the name of that process matching pid. Or in other words:



$ ps aux | grep $(xprop | awk -F'=' '/PID/ print $2') 
xieerqi 2124 0.6 1.7 208068 34604 ? Sl 18:47 1:49 gnome-terminal


Additionally, as per specifications , window managers should set WM_CLASS property. Thus, we can get that from xprop as well:



$ xprop WM_CLASS 
WM_CLASS(STRING) = "sakura", "Sakura"


Of course, this also has its 1% of disadvantages: setting WM_CLASS properties relies on window manager doing that, and PID is not guaranteed for a window to be accurate ( see What process created this X11 window? ), which may involve complex debugging. And these aren't shortcomings of the methods themselves but of X11 server. However, most stable and well known window managers ( like openbox, Metacity, blackbox ) and most applications are well behaved so we shouldn't expect problems with something like Gnome Terminal or Terminator.



But when it comes to GUI terminal emulators, we don't even need to find a command. We can just use the About dialog of the window itself. Exception to that rule is xterm.






share|improve this answer

























  • O_o $SHELL, sure

    – A.B.
    Jun 23 '15 at 19:59











  • Eek. Why do you people use ps | grep? ps -p $$! Or, just for the command, ps -p $$ -o cmd=.

    – muru
    Jun 23 '15 at 20:36











  • @muru because I'm less experienced user than you are, and I don't have all the ps flags memorized >_< bluntly

    – Sergiy Kolodyazhnyy
    Jun 23 '15 at 20:42






  • 2





    Neither do I, but ps | grep is just bad form. Most of what you can grep, can actually be obtained by ps itself, or by other tools.

    – muru
    Jun 23 '15 at 20:45











  • NOTE: I've updated my answer, since this question overall was originally unclear, and parts of it require some background; over time I also figured out there's better ways to invoke commands.

    – Sergiy Kolodyazhnyy
    1 hour ago


















12














The short version (thx @Serg)



cat /etc/alternatives/x-terminal-emulator



The long version



sudo update-alternatives --config x-terminal-emulator


and look for the * in the output



;)




Example output



There are 7 alternatives which provide `x-terminal-emulator’.


Selection Alternative
———————————————–
1 /usr/bin/xterm
2 /usr/bin/uxterm
3 /usr/bin/koi8rxterm
4 /usr/bin/lxterm
*+ 5 /usr/bin/gnome-terminal.wrapper
6 /usr/bin/konsole
7 /usr/bin/xfce4-terminal.wrapper


Press enter to keep the default[*], or type selection number:



Or, thanks to @muru, here is more detailed output



$ update-alternatives --display x-terminal-emulator
x-terminal-emulator - auto mode
link currently points to /usr/bin/gnome-terminal.wrapper
/usr/bin/gnome-terminal.wrapper - priority 40
slave x-terminal-emulator.1.gz: /usr/share/man/man1/gnome-terminal.1.gz
/usr/bin/koi8rxterm - priority 20
slave x-terminal-emulator.1.gz: /usr/share/man/man1/koi8rxterm.1.gz
/usr/bin/lxterm - priority 30
slave x-terminal-emulator.1.gz: /usr/share/man/man1/lxterm.1.gz
/usr/bin/mate-terminal.wrapper - priority 30
slave x-terminal-emulator.1.gz: /usr/share/man/man1/mate-terminal.1.gz
/usr/bin/uxterm - priority 20
slave x-terminal-emulator.1.gz: /usr/share/man/man1/uxterm.1.gz
/usr/bin/xterm - priority 20
slave x-terminal-emulator.1.gz: /usr/share/man/man1/xterm.1.gz
Current 'best' version is '/usr/bin/gnome-terminal.wrapper'.





share|improve this answer




















  • 2





    cat /etc/alternatives/x-terminal-emulator | grep exec

    – Sergiy Kolodyazhnyy
    Jun 23 '15 at 19:59











  • Is there a utility I need installed? I get either Binary file (standard input) matches or update-alternatives: error: unknown argument –config'`

    – Terrance
    Jun 23 '15 at 20:06











  • Nevermind, it is --config

    – Terrance
    Jun 23 '15 at 20:06






  • 1





    You don't need sudo. Use update-alternatives --display x-terminal-emulator

    – muru
    Jun 23 '15 at 20:34











  • For the short version you might consider using file /etc/alternatives/x-terminal-emulator to get the target of this symbolic link instead using cat on it. The file utility should be installed on most systems and can be used to find the target executable. cat on symbolic link could print any shell script or even binary file depending on the target of this link (shell script for gnome-terminal, binary file urxvt, etc.).

    – chris544
    Jul 18 '17 at 3:40



















9














If you want to know the terminal program you are using, use this:



ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$)


Run this just after opening the terminal (shell) without forking any further shell instance.



When you open up the terminal program, it basically spawns a child program, a shell. So the parent of the spawned shell is the terminal itself. In other words, the PPID of the shell is the PID of terminal program.



Here we are finding the parent process ID (PPID) of the shell (bash) by ps -o 'ppid=' -p $$ , which will be the process ID of terminal program.



Then we are finding the process name from the PID:



$ ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$)
gnome-terminal


It is basically a one liner of:



$ ps -o 'ppid=' -p $$
2268

$ ps -o 'cmd=' -p 2268
gnome-terminal





share|improve this answer























  • When I run this command I get sshd: username@pts/4. Note I'm using PuTTY to connect to the machine. Is sshd actually the terminal emulator?

    – user3731622
    Mar 21 '18 at 17:21


















3














Type in printenv from the terminal window to view all variables of the open session.



Type in echo $COLORTERM from the terminal window. NOTE: this does not work with all terminals, one like sakura does not report this back.



root@terrance-Linux:~# echo $COLORTERM
gnome-terminal


the one below is from an aterm terminal.



root@terrance-Linux:~$ echo $COLORTERM
rxvt-xpm





share|improve this answer

























  • echo $COLORTERM in sakura reports blank

    – Sergiy Kolodyazhnyy
    Jun 23 '15 at 19:46











  • @Serg thank you. It looks like it is a variant of xterm then.

    – Terrance
    Jun 23 '15 at 19:48











  • @Serg just wondering if you like Sakura? And what draws you to it?

    – Terrance
    Jun 23 '15 at 19:52











  • It's alright, nothing quite special, quite simplistic. I've tried variety of terminal emulators: terminator, roxterm, tilde, the dropdown one (forgot what it's called, something starting with R ). I guess it is a compromise between xterm and gnome-terminal

    – Sergiy Kolodyazhnyy
    Jun 23 '15 at 19:57











  • @Serg Ah, that is good to know. I am going to check that out. :-) I am always on the look out for a good terminal that works with my keepalive script that sends xdotool keys to them.

    – Terrance
    Jun 23 '15 at 19:59


















3














If you just want the name of the terminal program, you'll most probably find it under Help > About.






share|improve this answer






























    0














    cat /etc/alternatives/x-terminal-emulator | grep exec


    Sample output:




    exec('gnome-terminal',@args);




    There's the answer for my system: gnome-terminal.



    So, typing gnome-terminal into my terminal will now open up another identical terminal window.



    Sources:



    • Sergiy Kolodyazhnyy's comment under A.B.'s answer.





    share|improve this answer






























      -1














      Simple answer. Works for both console or ssh.



      Example for simple character terminal:



      ssh username@systemname
      echo $TERM
      dumb


      tells you that you can't open GUI apps on that connection



      Example for xterm (also works with PuTTY/Xming on Windows)



      ssh -Y username@systemname -- omit this if using PuTTY --
      echo $TERM
      xterm


      means that you can use GUI commands like opening the leafpad editor or nautilus file manager.



      On the console it is the same:



      Open terminal window
      echo $TERM
      xterm





      share|improve this answer

























      • TERM is not a variable that defines the default terminal emulator, but rather one that defines the capabilities of the current one. For example, setting the variable to "xterm-color" lets any program running in the terminal know that the current terminal is supposed to understand colours; setting it to "linux" tells programs that this is supposed to be a VT; etc.

        – Cybolic
        Dec 7 '17 at 0:54











      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "89"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f640096%2fhow-do-i-check-which-terminal-i-am-using%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      7 Answers
      7






      active

      oldest

      votes








      7 Answers
      7






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      13














      TL;DR



      • to find currently running shell use ls -l /proc/$$/exe

      • to find currently running terminal, use xprop _NET_WM_PID WM_CLASS. The value of pid later can be passed to ps -p <pid> -o args command.


      • Technically, for terminal emulator you don't even need a command, as stated in the comments:




        what do you mean by which? Click Help --> About is that it? – JoKeR




      Shell vs Terminal



      First thing we need to have clarified is what exactly is being asked - find out the running shell or running terminal. Often these two terms are used interchangeably, but they are different things altogether. Shell is the command-line interpreter, specifically interactive shell is the prompt plus text field where you enter commands. Shells can also be non-interactive, for example a script starts non-interactive shell, or bash -c 'echo hello world' also starts non-interactive shell.



      By contrast, terminal is the interface to shell ( though it could be another application as well). Originally terminal referred to actual hardware, but nowadays they're mostly software. What you see when you press Ctrl+Alt+t or click on the terminal icon in GUI, that starts a terminal emulator, a window which mimics behavior of hardware, and within that window you can see the shell running. Ctrl+Alt+F2 (or any of the 6 function keys) will open virtual console, aka tty. I recommend reading Why is a virtual terminal “virtual”, and what/why/where is the “real” terminal? for more info on the specifics.



      Getting the shell information



      Each user has a default shell assigned to them in /etc/passwd for their username. Assuming you are using default configuration and haven't called another shell explicitly as a command, it is sufficient to do:



      echo $SHELL


      But of course this only shows default value. Suppose we do the following:



      user@ubuntu:~$ dash
      $


      We were originally in bash, but started interactive session of /bin/dash, Ubuntu's POSIX or system shell. The variable $SHELL won't change, because that's not its purpose - it shows default not current value. We will need to approach this from another perspective - the perspective of a process, which is something I've covered in Am I using bash or sh?



      $ echo $$
      4824
      $ cat /proc/4824/comm
      mksh
      $ bash
      xieerqi@eagle:~$ echo $$
      6197
      xieerqi@eagle:~$ cat /proc/6197/comm
      bash


      Here we take advantage of /proc/ filesystem. The name of the process and command-line parameters are displayed in /proc/<pid>/comm. All we need is to provide shell's PID, which is what $$ does. In the example above I am adding that separately, but there is nothing stopping us from doing just



      cat /proc/$$/comm


      Variation on the theme could also be



      ps -p $$ -o args


      Another way we could approach this is via checking where /proc/<pid>/exe. This file is a symlink that points to the executable file. Thus we can do



      user@ubuntu:~$ ls -l /proc/$$/exe
      lrwxrwxrwx 1 adminx adminx 0 Apr 4 18:20 /proc/1241/exe -> /bin/bash
      user@ubuntu:~$ sh
      $ ls -l /proc/$$/exe
      lrwxrwxrwx 1 adminx adminx 0 Apr 4 18:20 /proc/1255/exe -> /bin/dash


      Either of the two approaches works in 99% of the cases. Of course, there are ways in which they can be subverted. For instance, symlink won't point anywhere if the executable was deleted shortly after the shell started ( and in that case you probably will encounter system issues, since removing /bin/sh, /bin/dash, or even /bin/bash is not recommended - after all a lot of scripts rely on them, especially system-level ones). Command name for shell is usually set as the very first argument in execve() syscall. This is covered in How does bash know how it is being invoked? , so if you have an application that launches a shell via execve(), it could give it any name. But these are non-standard and non-typical things, that should be avoided for the sake of consistency and security.




      Getting Terminal Information



      We can start with the environment variables. Many terminals seem to mask themselves as xterm-compatible, which is reported by echo $TERM or echo $COLORTERM. But then environment variables are not very reliable tool. They can be set and unset. We can do the same thing with PIDs again, except this time we will look at parent PID. As you may remember, terminal is the interface to the shell and often starts the shell itself. Therefore we can find out what process is the parent process of our shell:



      $ ps -p $$ -o args,ppid
      COMMAND PPID
      bash 1234
      $ ps -p 1234 -o args
      COMMAND
      /usr/lib/gnome-terminal/gnome-terminal-server


      Let's try with another terminal app, sakura:



      $ ps -p $$ -o args,ppid
      COMMAND PPID
      /bin/bash 16950
      $ ps -p 16950 -o args
      COMMAND
      sakura


      From there we can already see that what started this shell is gnome-terminal. This method of course works assuming you're working with interactive shell. If we're trying to find out the parent of bash -c '...' or the shell started via ssh, for example, PID may very well be from non-terminal application and maybe non-GUI at all.



      So if we want to specifically deal with GUI terminal, what we can do is run xprop, click on the desired window, grep its pid, and find out what's the name of that process matching pid. Or in other words:



      $ ps aux | grep $(xprop | awk -F'=' '/PID/ print $2') 
      xieerqi 2124 0.6 1.7 208068 34604 ? Sl 18:47 1:49 gnome-terminal


      Additionally, as per specifications , window managers should set WM_CLASS property. Thus, we can get that from xprop as well:



      $ xprop WM_CLASS 
      WM_CLASS(STRING) = "sakura", "Sakura"


      Of course, this also has its 1% of disadvantages: setting WM_CLASS properties relies on window manager doing that, and PID is not guaranteed for a window to be accurate ( see What process created this X11 window? ), which may involve complex debugging. And these aren't shortcomings of the methods themselves but of X11 server. However, most stable and well known window managers ( like openbox, Metacity, blackbox ) and most applications are well behaved so we shouldn't expect problems with something like Gnome Terminal or Terminator.



      But when it comes to GUI terminal emulators, we don't even need to find a command. We can just use the About dialog of the window itself. Exception to that rule is xterm.






      share|improve this answer

























      • O_o $SHELL, sure

        – A.B.
        Jun 23 '15 at 19:59











      • Eek. Why do you people use ps | grep? ps -p $$! Or, just for the command, ps -p $$ -o cmd=.

        – muru
        Jun 23 '15 at 20:36











      • @muru because I'm less experienced user than you are, and I don't have all the ps flags memorized >_< bluntly

        – Sergiy Kolodyazhnyy
        Jun 23 '15 at 20:42






      • 2





        Neither do I, but ps | grep is just bad form. Most of what you can grep, can actually be obtained by ps itself, or by other tools.

        – muru
        Jun 23 '15 at 20:45











      • NOTE: I've updated my answer, since this question overall was originally unclear, and parts of it require some background; over time I also figured out there's better ways to invoke commands.

        – Sergiy Kolodyazhnyy
        1 hour ago















      13














      TL;DR



      • to find currently running shell use ls -l /proc/$$/exe

      • to find currently running terminal, use xprop _NET_WM_PID WM_CLASS. The value of pid later can be passed to ps -p <pid> -o args command.


      • Technically, for terminal emulator you don't even need a command, as stated in the comments:




        what do you mean by which? Click Help --> About is that it? – JoKeR




      Shell vs Terminal



      First thing we need to have clarified is what exactly is being asked - find out the running shell or running terminal. Often these two terms are used interchangeably, but they are different things altogether. Shell is the command-line interpreter, specifically interactive shell is the prompt plus text field where you enter commands. Shells can also be non-interactive, for example a script starts non-interactive shell, or bash -c 'echo hello world' also starts non-interactive shell.



      By contrast, terminal is the interface to shell ( though it could be another application as well). Originally terminal referred to actual hardware, but nowadays they're mostly software. What you see when you press Ctrl+Alt+t or click on the terminal icon in GUI, that starts a terminal emulator, a window which mimics behavior of hardware, and within that window you can see the shell running. Ctrl+Alt+F2 (or any of the 6 function keys) will open virtual console, aka tty. I recommend reading Why is a virtual terminal “virtual”, and what/why/where is the “real” terminal? for more info on the specifics.



      Getting the shell information



      Each user has a default shell assigned to them in /etc/passwd for their username. Assuming you are using default configuration and haven't called another shell explicitly as a command, it is sufficient to do:



      echo $SHELL


      But of course this only shows default value. Suppose we do the following:



      user@ubuntu:~$ dash
      $


      We were originally in bash, but started interactive session of /bin/dash, Ubuntu's POSIX or system shell. The variable $SHELL won't change, because that's not its purpose - it shows default not current value. We will need to approach this from another perspective - the perspective of a process, which is something I've covered in Am I using bash or sh?



      $ echo $$
      4824
      $ cat /proc/4824/comm
      mksh
      $ bash
      xieerqi@eagle:~$ echo $$
      6197
      xieerqi@eagle:~$ cat /proc/6197/comm
      bash


      Here we take advantage of /proc/ filesystem. The name of the process and command-line parameters are displayed in /proc/<pid>/comm. All we need is to provide shell's PID, which is what $$ does. In the example above I am adding that separately, but there is nothing stopping us from doing just



      cat /proc/$$/comm


      Variation on the theme could also be



      ps -p $$ -o args


      Another way we could approach this is via checking where /proc/<pid>/exe. This file is a symlink that points to the executable file. Thus we can do



      user@ubuntu:~$ ls -l /proc/$$/exe
      lrwxrwxrwx 1 adminx adminx 0 Apr 4 18:20 /proc/1241/exe -> /bin/bash
      user@ubuntu:~$ sh
      $ ls -l /proc/$$/exe
      lrwxrwxrwx 1 adminx adminx 0 Apr 4 18:20 /proc/1255/exe -> /bin/dash


      Either of the two approaches works in 99% of the cases. Of course, there are ways in which they can be subverted. For instance, symlink won't point anywhere if the executable was deleted shortly after the shell started ( and in that case you probably will encounter system issues, since removing /bin/sh, /bin/dash, or even /bin/bash is not recommended - after all a lot of scripts rely on them, especially system-level ones). Command name for shell is usually set as the very first argument in execve() syscall. This is covered in How does bash know how it is being invoked? , so if you have an application that launches a shell via execve(), it could give it any name. But these are non-standard and non-typical things, that should be avoided for the sake of consistency and security.




      Getting Terminal Information



      We can start with the environment variables. Many terminals seem to mask themselves as xterm-compatible, which is reported by echo $TERM or echo $COLORTERM. But then environment variables are not very reliable tool. They can be set and unset. We can do the same thing with PIDs again, except this time we will look at parent PID. As you may remember, terminal is the interface to the shell and often starts the shell itself. Therefore we can find out what process is the parent process of our shell:



      $ ps -p $$ -o args,ppid
      COMMAND PPID
      bash 1234
      $ ps -p 1234 -o args
      COMMAND
      /usr/lib/gnome-terminal/gnome-terminal-server


      Let's try with another terminal app, sakura:



      $ ps -p $$ -o args,ppid
      COMMAND PPID
      /bin/bash 16950
      $ ps -p 16950 -o args
      COMMAND
      sakura


      From there we can already see that what started this shell is gnome-terminal. This method of course works assuming you're working with interactive shell. If we're trying to find out the parent of bash -c '...' or the shell started via ssh, for example, PID may very well be from non-terminal application and maybe non-GUI at all.



      So if we want to specifically deal with GUI terminal, what we can do is run xprop, click on the desired window, grep its pid, and find out what's the name of that process matching pid. Or in other words:



      $ ps aux | grep $(xprop | awk -F'=' '/PID/ print $2') 
      xieerqi 2124 0.6 1.7 208068 34604 ? Sl 18:47 1:49 gnome-terminal


      Additionally, as per specifications , window managers should set WM_CLASS property. Thus, we can get that from xprop as well:



      $ xprop WM_CLASS 
      WM_CLASS(STRING) = "sakura", "Sakura"


      Of course, this also has its 1% of disadvantages: setting WM_CLASS properties relies on window manager doing that, and PID is not guaranteed for a window to be accurate ( see What process created this X11 window? ), which may involve complex debugging. And these aren't shortcomings of the methods themselves but of X11 server. However, most stable and well known window managers ( like openbox, Metacity, blackbox ) and most applications are well behaved so we shouldn't expect problems with something like Gnome Terminal or Terminator.



      But when it comes to GUI terminal emulators, we don't even need to find a command. We can just use the About dialog of the window itself. Exception to that rule is xterm.






      share|improve this answer

























      • O_o $SHELL, sure

        – A.B.
        Jun 23 '15 at 19:59











      • Eek. Why do you people use ps | grep? ps -p $$! Or, just for the command, ps -p $$ -o cmd=.

        – muru
        Jun 23 '15 at 20:36











      • @muru because I'm less experienced user than you are, and I don't have all the ps flags memorized >_< bluntly

        – Sergiy Kolodyazhnyy
        Jun 23 '15 at 20:42






      • 2





        Neither do I, but ps | grep is just bad form. Most of what you can grep, can actually be obtained by ps itself, or by other tools.

        – muru
        Jun 23 '15 at 20:45











      • NOTE: I've updated my answer, since this question overall was originally unclear, and parts of it require some background; over time I also figured out there's better ways to invoke commands.

        – Sergiy Kolodyazhnyy
        1 hour ago













      13












      13








      13







      TL;DR



      • to find currently running shell use ls -l /proc/$$/exe

      • to find currently running terminal, use xprop _NET_WM_PID WM_CLASS. The value of pid later can be passed to ps -p <pid> -o args command.


      • Technically, for terminal emulator you don't even need a command, as stated in the comments:




        what do you mean by which? Click Help --> About is that it? – JoKeR




      Shell vs Terminal



      First thing we need to have clarified is what exactly is being asked - find out the running shell or running terminal. Often these two terms are used interchangeably, but they are different things altogether. Shell is the command-line interpreter, specifically interactive shell is the prompt plus text field where you enter commands. Shells can also be non-interactive, for example a script starts non-interactive shell, or bash -c 'echo hello world' also starts non-interactive shell.



      By contrast, terminal is the interface to shell ( though it could be another application as well). Originally terminal referred to actual hardware, but nowadays they're mostly software. What you see when you press Ctrl+Alt+t or click on the terminal icon in GUI, that starts a terminal emulator, a window which mimics behavior of hardware, and within that window you can see the shell running. Ctrl+Alt+F2 (or any of the 6 function keys) will open virtual console, aka tty. I recommend reading Why is a virtual terminal “virtual”, and what/why/where is the “real” terminal? for more info on the specifics.



      Getting the shell information



      Each user has a default shell assigned to them in /etc/passwd for their username. Assuming you are using default configuration and haven't called another shell explicitly as a command, it is sufficient to do:



      echo $SHELL


      But of course this only shows default value. Suppose we do the following:



      user@ubuntu:~$ dash
      $


      We were originally in bash, but started interactive session of /bin/dash, Ubuntu's POSIX or system shell. The variable $SHELL won't change, because that's not its purpose - it shows default not current value. We will need to approach this from another perspective - the perspective of a process, which is something I've covered in Am I using bash or sh?



      $ echo $$
      4824
      $ cat /proc/4824/comm
      mksh
      $ bash
      xieerqi@eagle:~$ echo $$
      6197
      xieerqi@eagle:~$ cat /proc/6197/comm
      bash


      Here we take advantage of /proc/ filesystem. The name of the process and command-line parameters are displayed in /proc/<pid>/comm. All we need is to provide shell's PID, which is what $$ does. In the example above I am adding that separately, but there is nothing stopping us from doing just



      cat /proc/$$/comm


      Variation on the theme could also be



      ps -p $$ -o args


      Another way we could approach this is via checking where /proc/<pid>/exe. This file is a symlink that points to the executable file. Thus we can do



      user@ubuntu:~$ ls -l /proc/$$/exe
      lrwxrwxrwx 1 adminx adminx 0 Apr 4 18:20 /proc/1241/exe -> /bin/bash
      user@ubuntu:~$ sh
      $ ls -l /proc/$$/exe
      lrwxrwxrwx 1 adminx adminx 0 Apr 4 18:20 /proc/1255/exe -> /bin/dash


      Either of the two approaches works in 99% of the cases. Of course, there are ways in which they can be subverted. For instance, symlink won't point anywhere if the executable was deleted shortly after the shell started ( and in that case you probably will encounter system issues, since removing /bin/sh, /bin/dash, or even /bin/bash is not recommended - after all a lot of scripts rely on them, especially system-level ones). Command name for shell is usually set as the very first argument in execve() syscall. This is covered in How does bash know how it is being invoked? , so if you have an application that launches a shell via execve(), it could give it any name. But these are non-standard and non-typical things, that should be avoided for the sake of consistency and security.




      Getting Terminal Information



      We can start with the environment variables. Many terminals seem to mask themselves as xterm-compatible, which is reported by echo $TERM or echo $COLORTERM. But then environment variables are not very reliable tool. They can be set and unset. We can do the same thing with PIDs again, except this time we will look at parent PID. As you may remember, terminal is the interface to the shell and often starts the shell itself. Therefore we can find out what process is the parent process of our shell:



      $ ps -p $$ -o args,ppid
      COMMAND PPID
      bash 1234
      $ ps -p 1234 -o args
      COMMAND
      /usr/lib/gnome-terminal/gnome-terminal-server


      Let's try with another terminal app, sakura:



      $ ps -p $$ -o args,ppid
      COMMAND PPID
      /bin/bash 16950
      $ ps -p 16950 -o args
      COMMAND
      sakura


      From there we can already see that what started this shell is gnome-terminal. This method of course works assuming you're working with interactive shell. If we're trying to find out the parent of bash -c '...' or the shell started via ssh, for example, PID may very well be from non-terminal application and maybe non-GUI at all.



      So if we want to specifically deal with GUI terminal, what we can do is run xprop, click on the desired window, grep its pid, and find out what's the name of that process matching pid. Or in other words:



      $ ps aux | grep $(xprop | awk -F'=' '/PID/ print $2') 
      xieerqi 2124 0.6 1.7 208068 34604 ? Sl 18:47 1:49 gnome-terminal


      Additionally, as per specifications , window managers should set WM_CLASS property. Thus, we can get that from xprop as well:



      $ xprop WM_CLASS 
      WM_CLASS(STRING) = "sakura", "Sakura"


      Of course, this also has its 1% of disadvantages: setting WM_CLASS properties relies on window manager doing that, and PID is not guaranteed for a window to be accurate ( see What process created this X11 window? ), which may involve complex debugging. And these aren't shortcomings of the methods themselves but of X11 server. However, most stable and well known window managers ( like openbox, Metacity, blackbox ) and most applications are well behaved so we shouldn't expect problems with something like Gnome Terminal or Terminator.



      But when it comes to GUI terminal emulators, we don't even need to find a command. We can just use the About dialog of the window itself. Exception to that rule is xterm.






      share|improve this answer















      TL;DR



      • to find currently running shell use ls -l /proc/$$/exe

      • to find currently running terminal, use xprop _NET_WM_PID WM_CLASS. The value of pid later can be passed to ps -p <pid> -o args command.


      • Technically, for terminal emulator you don't even need a command, as stated in the comments:




        what do you mean by which? Click Help --> About is that it? – JoKeR




      Shell vs Terminal



      First thing we need to have clarified is what exactly is being asked - find out the running shell or running terminal. Often these two terms are used interchangeably, but they are different things altogether. Shell is the command-line interpreter, specifically interactive shell is the prompt plus text field where you enter commands. Shells can also be non-interactive, for example a script starts non-interactive shell, or bash -c 'echo hello world' also starts non-interactive shell.



      By contrast, terminal is the interface to shell ( though it could be another application as well). Originally terminal referred to actual hardware, but nowadays they're mostly software. What you see when you press Ctrl+Alt+t or click on the terminal icon in GUI, that starts a terminal emulator, a window which mimics behavior of hardware, and within that window you can see the shell running. Ctrl+Alt+F2 (or any of the 6 function keys) will open virtual console, aka tty. I recommend reading Why is a virtual terminal “virtual”, and what/why/where is the “real” terminal? for more info on the specifics.



      Getting the shell information



      Each user has a default shell assigned to them in /etc/passwd for their username. Assuming you are using default configuration and haven't called another shell explicitly as a command, it is sufficient to do:



      echo $SHELL


      But of course this only shows default value. Suppose we do the following:



      user@ubuntu:~$ dash
      $


      We were originally in bash, but started interactive session of /bin/dash, Ubuntu's POSIX or system shell. The variable $SHELL won't change, because that's not its purpose - it shows default not current value. We will need to approach this from another perspective - the perspective of a process, which is something I've covered in Am I using bash or sh?



      $ echo $$
      4824
      $ cat /proc/4824/comm
      mksh
      $ bash
      xieerqi@eagle:~$ echo $$
      6197
      xieerqi@eagle:~$ cat /proc/6197/comm
      bash


      Here we take advantage of /proc/ filesystem. The name of the process and command-line parameters are displayed in /proc/<pid>/comm. All we need is to provide shell's PID, which is what $$ does. In the example above I am adding that separately, but there is nothing stopping us from doing just



      cat /proc/$$/comm


      Variation on the theme could also be



      ps -p $$ -o args


      Another way we could approach this is via checking where /proc/<pid>/exe. This file is a symlink that points to the executable file. Thus we can do



      user@ubuntu:~$ ls -l /proc/$$/exe
      lrwxrwxrwx 1 adminx adminx 0 Apr 4 18:20 /proc/1241/exe -> /bin/bash
      user@ubuntu:~$ sh
      $ ls -l /proc/$$/exe
      lrwxrwxrwx 1 adminx adminx 0 Apr 4 18:20 /proc/1255/exe -> /bin/dash


      Either of the two approaches works in 99% of the cases. Of course, there are ways in which they can be subverted. For instance, symlink won't point anywhere if the executable was deleted shortly after the shell started ( and in that case you probably will encounter system issues, since removing /bin/sh, /bin/dash, or even /bin/bash is not recommended - after all a lot of scripts rely on them, especially system-level ones). Command name for shell is usually set as the very first argument in execve() syscall. This is covered in How does bash know how it is being invoked? , so if you have an application that launches a shell via execve(), it could give it any name. But these are non-standard and non-typical things, that should be avoided for the sake of consistency and security.




      Getting Terminal Information



      We can start with the environment variables. Many terminals seem to mask themselves as xterm-compatible, which is reported by echo $TERM or echo $COLORTERM. But then environment variables are not very reliable tool. They can be set and unset. We can do the same thing with PIDs again, except this time we will look at parent PID. As you may remember, terminal is the interface to the shell and often starts the shell itself. Therefore we can find out what process is the parent process of our shell:



      $ ps -p $$ -o args,ppid
      COMMAND PPID
      bash 1234
      $ ps -p 1234 -o args
      COMMAND
      /usr/lib/gnome-terminal/gnome-terminal-server


      Let's try with another terminal app, sakura:



      $ ps -p $$ -o args,ppid
      COMMAND PPID
      /bin/bash 16950
      $ ps -p 16950 -o args
      COMMAND
      sakura


      From there we can already see that what started this shell is gnome-terminal. This method of course works assuming you're working with interactive shell. If we're trying to find out the parent of bash -c '...' or the shell started via ssh, for example, PID may very well be from non-terminal application and maybe non-GUI at all.



      So if we want to specifically deal with GUI terminal, what we can do is run xprop, click on the desired window, grep its pid, and find out what's the name of that process matching pid. Or in other words:



      $ ps aux | grep $(xprop | awk -F'=' '/PID/ print $2') 
      xieerqi 2124 0.6 1.7 208068 34604 ? Sl 18:47 1:49 gnome-terminal


      Additionally, as per specifications , window managers should set WM_CLASS property. Thus, we can get that from xprop as well:



      $ xprop WM_CLASS 
      WM_CLASS(STRING) = "sakura", "Sakura"


      Of course, this also has its 1% of disadvantages: setting WM_CLASS properties relies on window manager doing that, and PID is not guaranteed for a window to be accurate ( see What process created this X11 window? ), which may involve complex debugging. And these aren't shortcomings of the methods themselves but of X11 server. However, most stable and well known window managers ( like openbox, Metacity, blackbox ) and most applications are well behaved so we shouldn't expect problems with something like Gnome Terminal or Terminator.



      But when it comes to GUI terminal emulators, we don't even need to find a command. We can just use the About dialog of the window itself. Exception to that rule is xterm.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited 1 hour ago

























      answered Jun 23 '15 at 19:55









      Sergiy KolodyazhnyySergiy Kolodyazhnyy

      74.9k9155326




      74.9k9155326












      • O_o $SHELL, sure

        – A.B.
        Jun 23 '15 at 19:59











      • Eek. Why do you people use ps | grep? ps -p $$! Or, just for the command, ps -p $$ -o cmd=.

        – muru
        Jun 23 '15 at 20:36











      • @muru because I'm less experienced user than you are, and I don't have all the ps flags memorized >_< bluntly

        – Sergiy Kolodyazhnyy
        Jun 23 '15 at 20:42






      • 2





        Neither do I, but ps | grep is just bad form. Most of what you can grep, can actually be obtained by ps itself, or by other tools.

        – muru
        Jun 23 '15 at 20:45











      • NOTE: I've updated my answer, since this question overall was originally unclear, and parts of it require some background; over time I also figured out there's better ways to invoke commands.

        – Sergiy Kolodyazhnyy
        1 hour ago

















      • O_o $SHELL, sure

        – A.B.
        Jun 23 '15 at 19:59











      • Eek. Why do you people use ps | grep? ps -p $$! Or, just for the command, ps -p $$ -o cmd=.

        – muru
        Jun 23 '15 at 20:36











      • @muru because I'm less experienced user than you are, and I don't have all the ps flags memorized >_< bluntly

        – Sergiy Kolodyazhnyy
        Jun 23 '15 at 20:42






      • 2





        Neither do I, but ps | grep is just bad form. Most of what you can grep, can actually be obtained by ps itself, or by other tools.

        – muru
        Jun 23 '15 at 20:45











      • NOTE: I've updated my answer, since this question overall was originally unclear, and parts of it require some background; over time I also figured out there's better ways to invoke commands.

        – Sergiy Kolodyazhnyy
        1 hour ago
















      O_o $SHELL, sure

      – A.B.
      Jun 23 '15 at 19:59





      O_o $SHELL, sure

      – A.B.
      Jun 23 '15 at 19:59













      Eek. Why do you people use ps | grep? ps -p $$! Or, just for the command, ps -p $$ -o cmd=.

      – muru
      Jun 23 '15 at 20:36





      Eek. Why do you people use ps | grep? ps -p $$! Or, just for the command, ps -p $$ -o cmd=.

      – muru
      Jun 23 '15 at 20:36













      @muru because I'm less experienced user than you are, and I don't have all the ps flags memorized >_< bluntly

      – Sergiy Kolodyazhnyy
      Jun 23 '15 at 20:42





      @muru because I'm less experienced user than you are, and I don't have all the ps flags memorized >_< bluntly

      – Sergiy Kolodyazhnyy
      Jun 23 '15 at 20:42




      2




      2





      Neither do I, but ps | grep is just bad form. Most of what you can grep, can actually be obtained by ps itself, or by other tools.

      – muru
      Jun 23 '15 at 20:45





      Neither do I, but ps | grep is just bad form. Most of what you can grep, can actually be obtained by ps itself, or by other tools.

      – muru
      Jun 23 '15 at 20:45













      NOTE: I've updated my answer, since this question overall was originally unclear, and parts of it require some background; over time I also figured out there's better ways to invoke commands.

      – Sergiy Kolodyazhnyy
      1 hour ago





      NOTE: I've updated my answer, since this question overall was originally unclear, and parts of it require some background; over time I also figured out there's better ways to invoke commands.

      – Sergiy Kolodyazhnyy
      1 hour ago













      12














      The short version (thx @Serg)



      cat /etc/alternatives/x-terminal-emulator



      The long version



      sudo update-alternatives --config x-terminal-emulator


      and look for the * in the output



      ;)




      Example output



      There are 7 alternatives which provide `x-terminal-emulator’.


      Selection Alternative
      ———————————————–
      1 /usr/bin/xterm
      2 /usr/bin/uxterm
      3 /usr/bin/koi8rxterm
      4 /usr/bin/lxterm
      *+ 5 /usr/bin/gnome-terminal.wrapper
      6 /usr/bin/konsole
      7 /usr/bin/xfce4-terminal.wrapper


      Press enter to keep the default[*], or type selection number:



      Or, thanks to @muru, here is more detailed output



      $ update-alternatives --display x-terminal-emulator
      x-terminal-emulator - auto mode
      link currently points to /usr/bin/gnome-terminal.wrapper
      /usr/bin/gnome-terminal.wrapper - priority 40
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/gnome-terminal.1.gz
      /usr/bin/koi8rxterm - priority 20
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/koi8rxterm.1.gz
      /usr/bin/lxterm - priority 30
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/lxterm.1.gz
      /usr/bin/mate-terminal.wrapper - priority 30
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/mate-terminal.1.gz
      /usr/bin/uxterm - priority 20
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/uxterm.1.gz
      /usr/bin/xterm - priority 20
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/xterm.1.gz
      Current 'best' version is '/usr/bin/gnome-terminal.wrapper'.





      share|improve this answer




















      • 2





        cat /etc/alternatives/x-terminal-emulator | grep exec

        – Sergiy Kolodyazhnyy
        Jun 23 '15 at 19:59











      • Is there a utility I need installed? I get either Binary file (standard input) matches or update-alternatives: error: unknown argument –config'`

        – Terrance
        Jun 23 '15 at 20:06











      • Nevermind, it is --config

        – Terrance
        Jun 23 '15 at 20:06






      • 1





        You don't need sudo. Use update-alternatives --display x-terminal-emulator

        – muru
        Jun 23 '15 at 20:34











      • For the short version you might consider using file /etc/alternatives/x-terminal-emulator to get the target of this symbolic link instead using cat on it. The file utility should be installed on most systems and can be used to find the target executable. cat on symbolic link could print any shell script or even binary file depending on the target of this link (shell script for gnome-terminal, binary file urxvt, etc.).

        – chris544
        Jul 18 '17 at 3:40
















      12














      The short version (thx @Serg)



      cat /etc/alternatives/x-terminal-emulator



      The long version



      sudo update-alternatives --config x-terminal-emulator


      and look for the * in the output



      ;)




      Example output



      There are 7 alternatives which provide `x-terminal-emulator’.


      Selection Alternative
      ———————————————–
      1 /usr/bin/xterm
      2 /usr/bin/uxterm
      3 /usr/bin/koi8rxterm
      4 /usr/bin/lxterm
      *+ 5 /usr/bin/gnome-terminal.wrapper
      6 /usr/bin/konsole
      7 /usr/bin/xfce4-terminal.wrapper


      Press enter to keep the default[*], or type selection number:



      Or, thanks to @muru, here is more detailed output



      $ update-alternatives --display x-terminal-emulator
      x-terminal-emulator - auto mode
      link currently points to /usr/bin/gnome-terminal.wrapper
      /usr/bin/gnome-terminal.wrapper - priority 40
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/gnome-terminal.1.gz
      /usr/bin/koi8rxterm - priority 20
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/koi8rxterm.1.gz
      /usr/bin/lxterm - priority 30
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/lxterm.1.gz
      /usr/bin/mate-terminal.wrapper - priority 30
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/mate-terminal.1.gz
      /usr/bin/uxterm - priority 20
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/uxterm.1.gz
      /usr/bin/xterm - priority 20
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/xterm.1.gz
      Current 'best' version is '/usr/bin/gnome-terminal.wrapper'.





      share|improve this answer




















      • 2





        cat /etc/alternatives/x-terminal-emulator | grep exec

        – Sergiy Kolodyazhnyy
        Jun 23 '15 at 19:59











      • Is there a utility I need installed? I get either Binary file (standard input) matches or update-alternatives: error: unknown argument –config'`

        – Terrance
        Jun 23 '15 at 20:06











      • Nevermind, it is --config

        – Terrance
        Jun 23 '15 at 20:06






      • 1





        You don't need sudo. Use update-alternatives --display x-terminal-emulator

        – muru
        Jun 23 '15 at 20:34











      • For the short version you might consider using file /etc/alternatives/x-terminal-emulator to get the target of this symbolic link instead using cat on it. The file utility should be installed on most systems and can be used to find the target executable. cat on symbolic link could print any shell script or even binary file depending on the target of this link (shell script for gnome-terminal, binary file urxvt, etc.).

        – chris544
        Jul 18 '17 at 3:40














      12












      12








      12







      The short version (thx @Serg)



      cat /etc/alternatives/x-terminal-emulator



      The long version



      sudo update-alternatives --config x-terminal-emulator


      and look for the * in the output



      ;)




      Example output



      There are 7 alternatives which provide `x-terminal-emulator’.


      Selection Alternative
      ———————————————–
      1 /usr/bin/xterm
      2 /usr/bin/uxterm
      3 /usr/bin/koi8rxterm
      4 /usr/bin/lxterm
      *+ 5 /usr/bin/gnome-terminal.wrapper
      6 /usr/bin/konsole
      7 /usr/bin/xfce4-terminal.wrapper


      Press enter to keep the default[*], or type selection number:



      Or, thanks to @muru, here is more detailed output



      $ update-alternatives --display x-terminal-emulator
      x-terminal-emulator - auto mode
      link currently points to /usr/bin/gnome-terminal.wrapper
      /usr/bin/gnome-terminal.wrapper - priority 40
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/gnome-terminal.1.gz
      /usr/bin/koi8rxterm - priority 20
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/koi8rxterm.1.gz
      /usr/bin/lxterm - priority 30
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/lxterm.1.gz
      /usr/bin/mate-terminal.wrapper - priority 30
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/mate-terminal.1.gz
      /usr/bin/uxterm - priority 20
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/uxterm.1.gz
      /usr/bin/xterm - priority 20
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/xterm.1.gz
      Current 'best' version is '/usr/bin/gnome-terminal.wrapper'.





      share|improve this answer















      The short version (thx @Serg)



      cat /etc/alternatives/x-terminal-emulator



      The long version



      sudo update-alternatives --config x-terminal-emulator


      and look for the * in the output



      ;)




      Example output



      There are 7 alternatives which provide `x-terminal-emulator’.


      Selection Alternative
      ———————————————–
      1 /usr/bin/xterm
      2 /usr/bin/uxterm
      3 /usr/bin/koi8rxterm
      4 /usr/bin/lxterm
      *+ 5 /usr/bin/gnome-terminal.wrapper
      6 /usr/bin/konsole
      7 /usr/bin/xfce4-terminal.wrapper


      Press enter to keep the default[*], or type selection number:



      Or, thanks to @muru, here is more detailed output



      $ update-alternatives --display x-terminal-emulator
      x-terminal-emulator - auto mode
      link currently points to /usr/bin/gnome-terminal.wrapper
      /usr/bin/gnome-terminal.wrapper - priority 40
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/gnome-terminal.1.gz
      /usr/bin/koi8rxterm - priority 20
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/koi8rxterm.1.gz
      /usr/bin/lxterm - priority 30
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/lxterm.1.gz
      /usr/bin/mate-terminal.wrapper - priority 30
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/mate-terminal.1.gz
      /usr/bin/uxterm - priority 20
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/uxterm.1.gz
      /usr/bin/xterm - priority 20
      slave x-terminal-emulator.1.gz: /usr/share/man/man1/xterm.1.gz
      Current 'best' version is '/usr/bin/gnome-terminal.wrapper'.






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Oct 14 '17 at 16:03









      Suncatcher

      123117




      123117










      answered Jun 23 '15 at 19:54









      A.B.A.B.

      69.7k12172266




      69.7k12172266







      • 2





        cat /etc/alternatives/x-terminal-emulator | grep exec

        – Sergiy Kolodyazhnyy
        Jun 23 '15 at 19:59











      • Is there a utility I need installed? I get either Binary file (standard input) matches or update-alternatives: error: unknown argument –config'`

        – Terrance
        Jun 23 '15 at 20:06











      • Nevermind, it is --config

        – Terrance
        Jun 23 '15 at 20:06






      • 1





        You don't need sudo. Use update-alternatives --display x-terminal-emulator

        – muru
        Jun 23 '15 at 20:34











      • For the short version you might consider using file /etc/alternatives/x-terminal-emulator to get the target of this symbolic link instead using cat on it. The file utility should be installed on most systems and can be used to find the target executable. cat on symbolic link could print any shell script or even binary file depending on the target of this link (shell script for gnome-terminal, binary file urxvt, etc.).

        – chris544
        Jul 18 '17 at 3:40













      • 2





        cat /etc/alternatives/x-terminal-emulator | grep exec

        – Sergiy Kolodyazhnyy
        Jun 23 '15 at 19:59











      • Is there a utility I need installed? I get either Binary file (standard input) matches or update-alternatives: error: unknown argument –config'`

        – Terrance
        Jun 23 '15 at 20:06











      • Nevermind, it is --config

        – Terrance
        Jun 23 '15 at 20:06






      • 1





        You don't need sudo. Use update-alternatives --display x-terminal-emulator

        – muru
        Jun 23 '15 at 20:34











      • For the short version you might consider using file /etc/alternatives/x-terminal-emulator to get the target of this symbolic link instead using cat on it. The file utility should be installed on most systems and can be used to find the target executable. cat on symbolic link could print any shell script or even binary file depending on the target of this link (shell script for gnome-terminal, binary file urxvt, etc.).

        – chris544
        Jul 18 '17 at 3:40








      2




      2





      cat /etc/alternatives/x-terminal-emulator | grep exec

      – Sergiy Kolodyazhnyy
      Jun 23 '15 at 19:59





      cat /etc/alternatives/x-terminal-emulator | grep exec

      – Sergiy Kolodyazhnyy
      Jun 23 '15 at 19:59













      Is there a utility I need installed? I get either Binary file (standard input) matches or update-alternatives: error: unknown argument –config'`

      – Terrance
      Jun 23 '15 at 20:06





      Is there a utility I need installed? I get either Binary file (standard input) matches or update-alternatives: error: unknown argument –config'`

      – Terrance
      Jun 23 '15 at 20:06













      Nevermind, it is --config

      – Terrance
      Jun 23 '15 at 20:06





      Nevermind, it is --config

      – Terrance
      Jun 23 '15 at 20:06




      1




      1





      You don't need sudo. Use update-alternatives --display x-terminal-emulator

      – muru
      Jun 23 '15 at 20:34





      You don't need sudo. Use update-alternatives --display x-terminal-emulator

      – muru
      Jun 23 '15 at 20:34













      For the short version you might consider using file /etc/alternatives/x-terminal-emulator to get the target of this symbolic link instead using cat on it. The file utility should be installed on most systems and can be used to find the target executable. cat on symbolic link could print any shell script or even binary file depending on the target of this link (shell script for gnome-terminal, binary file urxvt, etc.).

      – chris544
      Jul 18 '17 at 3:40






      For the short version you might consider using file /etc/alternatives/x-terminal-emulator to get the target of this symbolic link instead using cat on it. The file utility should be installed on most systems and can be used to find the target executable. cat on symbolic link could print any shell script or even binary file depending on the target of this link (shell script for gnome-terminal, binary file urxvt, etc.).

      – chris544
      Jul 18 '17 at 3:40












      9














      If you want to know the terminal program you are using, use this:



      ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$)


      Run this just after opening the terminal (shell) without forking any further shell instance.



      When you open up the terminal program, it basically spawns a child program, a shell. So the parent of the spawned shell is the terminal itself. In other words, the PPID of the shell is the PID of terminal program.



      Here we are finding the parent process ID (PPID) of the shell (bash) by ps -o 'ppid=' -p $$ , which will be the process ID of terminal program.



      Then we are finding the process name from the PID:



      $ ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$)
      gnome-terminal


      It is basically a one liner of:



      $ ps -o 'ppid=' -p $$
      2268

      $ ps -o 'cmd=' -p 2268
      gnome-terminal





      share|improve this answer























      • When I run this command I get sshd: username@pts/4. Note I'm using PuTTY to connect to the machine. Is sshd actually the terminal emulator?

        – user3731622
        Mar 21 '18 at 17:21















      9














      If you want to know the terminal program you are using, use this:



      ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$)


      Run this just after opening the terminal (shell) without forking any further shell instance.



      When you open up the terminal program, it basically spawns a child program, a shell. So the parent of the spawned shell is the terminal itself. In other words, the PPID of the shell is the PID of terminal program.



      Here we are finding the parent process ID (PPID) of the shell (bash) by ps -o 'ppid=' -p $$ , which will be the process ID of terminal program.



      Then we are finding the process name from the PID:



      $ ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$)
      gnome-terminal


      It is basically a one liner of:



      $ ps -o 'ppid=' -p $$
      2268

      $ ps -o 'cmd=' -p 2268
      gnome-terminal





      share|improve this answer























      • When I run this command I get sshd: username@pts/4. Note I'm using PuTTY to connect to the machine. Is sshd actually the terminal emulator?

        – user3731622
        Mar 21 '18 at 17:21













      9












      9








      9







      If you want to know the terminal program you are using, use this:



      ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$)


      Run this just after opening the terminal (shell) without forking any further shell instance.



      When you open up the terminal program, it basically spawns a child program, a shell. So the parent of the spawned shell is the terminal itself. In other words, the PPID of the shell is the PID of terminal program.



      Here we are finding the parent process ID (PPID) of the shell (bash) by ps -o 'ppid=' -p $$ , which will be the process ID of terminal program.



      Then we are finding the process name from the PID:



      $ ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$)
      gnome-terminal


      It is basically a one liner of:



      $ ps -o 'ppid=' -p $$
      2268

      $ ps -o 'cmd=' -p 2268
      gnome-terminal





      share|improve this answer













      If you want to know the terminal program you are using, use this:



      ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$)


      Run this just after opening the terminal (shell) without forking any further shell instance.



      When you open up the terminal program, it basically spawns a child program, a shell. So the parent of the spawned shell is the terminal itself. In other words, the PPID of the shell is the PID of terminal program.



      Here we are finding the parent process ID (PPID) of the shell (bash) by ps -o 'ppid=' -p $$ , which will be the process ID of terminal program.



      Then we are finding the process name from the PID:



      $ ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$)
      gnome-terminal


      It is basically a one liner of:



      $ ps -o 'ppid=' -p $$
      2268

      $ ps -o 'cmd=' -p 2268
      gnome-terminal






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jun 23 '15 at 20:08









      heemaylheemayl

      67.8k11142214




      67.8k11142214












      • When I run this command I get sshd: username@pts/4. Note I'm using PuTTY to connect to the machine. Is sshd actually the terminal emulator?

        – user3731622
        Mar 21 '18 at 17:21

















      • When I run this command I get sshd: username@pts/4. Note I'm using PuTTY to connect to the machine. Is sshd actually the terminal emulator?

        – user3731622
        Mar 21 '18 at 17:21
















      When I run this command I get sshd: username@pts/4. Note I'm using PuTTY to connect to the machine. Is sshd actually the terminal emulator?

      – user3731622
      Mar 21 '18 at 17:21





      When I run this command I get sshd: username@pts/4. Note I'm using PuTTY to connect to the machine. Is sshd actually the terminal emulator?

      – user3731622
      Mar 21 '18 at 17:21











      3














      Type in printenv from the terminal window to view all variables of the open session.



      Type in echo $COLORTERM from the terminal window. NOTE: this does not work with all terminals, one like sakura does not report this back.



      root@terrance-Linux:~# echo $COLORTERM
      gnome-terminal


      the one below is from an aterm terminal.



      root@terrance-Linux:~$ echo $COLORTERM
      rxvt-xpm





      share|improve this answer

























      • echo $COLORTERM in sakura reports blank

        – Sergiy Kolodyazhnyy
        Jun 23 '15 at 19:46











      • @Serg thank you. It looks like it is a variant of xterm then.

        – Terrance
        Jun 23 '15 at 19:48











      • @Serg just wondering if you like Sakura? And what draws you to it?

        – Terrance
        Jun 23 '15 at 19:52











      • It's alright, nothing quite special, quite simplistic. I've tried variety of terminal emulators: terminator, roxterm, tilde, the dropdown one (forgot what it's called, something starting with R ). I guess it is a compromise between xterm and gnome-terminal

        – Sergiy Kolodyazhnyy
        Jun 23 '15 at 19:57











      • @Serg Ah, that is good to know. I am going to check that out. :-) I am always on the look out for a good terminal that works with my keepalive script that sends xdotool keys to them.

        – Terrance
        Jun 23 '15 at 19:59















      3














      Type in printenv from the terminal window to view all variables of the open session.



      Type in echo $COLORTERM from the terminal window. NOTE: this does not work with all terminals, one like sakura does not report this back.



      root@terrance-Linux:~# echo $COLORTERM
      gnome-terminal


      the one below is from an aterm terminal.



      root@terrance-Linux:~$ echo $COLORTERM
      rxvt-xpm





      share|improve this answer

























      • echo $COLORTERM in sakura reports blank

        – Sergiy Kolodyazhnyy
        Jun 23 '15 at 19:46











      • @Serg thank you. It looks like it is a variant of xterm then.

        – Terrance
        Jun 23 '15 at 19:48











      • @Serg just wondering if you like Sakura? And what draws you to it?

        – Terrance
        Jun 23 '15 at 19:52











      • It's alright, nothing quite special, quite simplistic. I've tried variety of terminal emulators: terminator, roxterm, tilde, the dropdown one (forgot what it's called, something starting with R ). I guess it is a compromise between xterm and gnome-terminal

        – Sergiy Kolodyazhnyy
        Jun 23 '15 at 19:57











      • @Serg Ah, that is good to know. I am going to check that out. :-) I am always on the look out for a good terminal that works with my keepalive script that sends xdotool keys to them.

        – Terrance
        Jun 23 '15 at 19:59













      3












      3








      3







      Type in printenv from the terminal window to view all variables of the open session.



      Type in echo $COLORTERM from the terminal window. NOTE: this does not work with all terminals, one like sakura does not report this back.



      root@terrance-Linux:~# echo $COLORTERM
      gnome-terminal


      the one below is from an aterm terminal.



      root@terrance-Linux:~$ echo $COLORTERM
      rxvt-xpm





      share|improve this answer















      Type in printenv from the terminal window to view all variables of the open session.



      Type in echo $COLORTERM from the terminal window. NOTE: this does not work with all terminals, one like sakura does not report this back.



      root@terrance-Linux:~# echo $COLORTERM
      gnome-terminal


      the one below is from an aterm terminal.



      root@terrance-Linux:~$ echo $COLORTERM
      rxvt-xpm






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jun 23 '15 at 19:51

























      answered Jun 23 '15 at 19:35









      TerranceTerrance

      20.4k34898




      20.4k34898












      • echo $COLORTERM in sakura reports blank

        – Sergiy Kolodyazhnyy
        Jun 23 '15 at 19:46











      • @Serg thank you. It looks like it is a variant of xterm then.

        – Terrance
        Jun 23 '15 at 19:48











      • @Serg just wondering if you like Sakura? And what draws you to it?

        – Terrance
        Jun 23 '15 at 19:52











      • It's alright, nothing quite special, quite simplistic. I've tried variety of terminal emulators: terminator, roxterm, tilde, the dropdown one (forgot what it's called, something starting with R ). I guess it is a compromise between xterm and gnome-terminal

        – Sergiy Kolodyazhnyy
        Jun 23 '15 at 19:57











      • @Serg Ah, that is good to know. I am going to check that out. :-) I am always on the look out for a good terminal that works with my keepalive script that sends xdotool keys to them.

        – Terrance
        Jun 23 '15 at 19:59

















      • echo $COLORTERM in sakura reports blank

        – Sergiy Kolodyazhnyy
        Jun 23 '15 at 19:46











      • @Serg thank you. It looks like it is a variant of xterm then.

        – Terrance
        Jun 23 '15 at 19:48











      • @Serg just wondering if you like Sakura? And what draws you to it?

        – Terrance
        Jun 23 '15 at 19:52











      • It's alright, nothing quite special, quite simplistic. I've tried variety of terminal emulators: terminator, roxterm, tilde, the dropdown one (forgot what it's called, something starting with R ). I guess it is a compromise between xterm and gnome-terminal

        – Sergiy Kolodyazhnyy
        Jun 23 '15 at 19:57











      • @Serg Ah, that is good to know. I am going to check that out. :-) I am always on the look out for a good terminal that works with my keepalive script that sends xdotool keys to them.

        – Terrance
        Jun 23 '15 at 19:59
















      echo $COLORTERM in sakura reports blank

      – Sergiy Kolodyazhnyy
      Jun 23 '15 at 19:46





      echo $COLORTERM in sakura reports blank

      – Sergiy Kolodyazhnyy
      Jun 23 '15 at 19:46













      @Serg thank you. It looks like it is a variant of xterm then.

      – Terrance
      Jun 23 '15 at 19:48





      @Serg thank you. It looks like it is a variant of xterm then.

      – Terrance
      Jun 23 '15 at 19:48













      @Serg just wondering if you like Sakura? And what draws you to it?

      – Terrance
      Jun 23 '15 at 19:52





      @Serg just wondering if you like Sakura? And what draws you to it?

      – Terrance
      Jun 23 '15 at 19:52













      It's alright, nothing quite special, quite simplistic. I've tried variety of terminal emulators: terminator, roxterm, tilde, the dropdown one (forgot what it's called, something starting with R ). I guess it is a compromise between xterm and gnome-terminal

      – Sergiy Kolodyazhnyy
      Jun 23 '15 at 19:57





      It's alright, nothing quite special, quite simplistic. I've tried variety of terminal emulators: terminator, roxterm, tilde, the dropdown one (forgot what it's called, something starting with R ). I guess it is a compromise between xterm and gnome-terminal

      – Sergiy Kolodyazhnyy
      Jun 23 '15 at 19:57













      @Serg Ah, that is good to know. I am going to check that out. :-) I am always on the look out for a good terminal that works with my keepalive script that sends xdotool keys to them.

      – Terrance
      Jun 23 '15 at 19:59





      @Serg Ah, that is good to know. I am going to check that out. :-) I am always on the look out for a good terminal that works with my keepalive script that sends xdotool keys to them.

      – Terrance
      Jun 23 '15 at 19:59











      3














      If you just want the name of the terminal program, you'll most probably find it under Help > About.






      share|improve this answer



























        3














        If you just want the name of the terminal program, you'll most probably find it under Help > About.






        share|improve this answer

























          3












          3








          3







          If you just want the name of the terminal program, you'll most probably find it under Help > About.






          share|improve this answer













          If you just want the name of the terminal program, you'll most probably find it under Help > About.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jun 23 '15 at 20:07









          thesdogthesdog

          13617




          13617





















              0














              cat /etc/alternatives/x-terminal-emulator | grep exec


              Sample output:




              exec('gnome-terminal',@args);




              There's the answer for my system: gnome-terminal.



              So, typing gnome-terminal into my terminal will now open up another identical terminal window.



              Sources:



              • Sergiy Kolodyazhnyy's comment under A.B.'s answer.





              share|improve this answer



























                0














                cat /etc/alternatives/x-terminal-emulator | grep exec


                Sample output:




                exec('gnome-terminal',@args);




                There's the answer for my system: gnome-terminal.



                So, typing gnome-terminal into my terminal will now open up another identical terminal window.



                Sources:



                • Sergiy Kolodyazhnyy's comment under A.B.'s answer.





                share|improve this answer

























                  0












                  0








                  0







                  cat /etc/alternatives/x-terminal-emulator | grep exec


                  Sample output:




                  exec('gnome-terminal',@args);




                  There's the answer for my system: gnome-terminal.



                  So, typing gnome-terminal into my terminal will now open up another identical terminal window.



                  Sources:



                  • Sergiy Kolodyazhnyy's comment under A.B.'s answer.





                  share|improve this answer













                  cat /etc/alternatives/x-terminal-emulator | grep exec


                  Sample output:




                  exec('gnome-terminal',@args);




                  There's the answer for my system: gnome-terminal.



                  So, typing gnome-terminal into my terminal will now open up another identical terminal window.



                  Sources:



                  • Sergiy Kolodyazhnyy's comment under A.B.'s answer.






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 1 '18 at 23:39









                  Gabriel StaplesGabriel Staples

                  83611024




                  83611024





















                      -1














                      Simple answer. Works for both console or ssh.



                      Example for simple character terminal:



                      ssh username@systemname
                      echo $TERM
                      dumb


                      tells you that you can't open GUI apps on that connection



                      Example for xterm (also works with PuTTY/Xming on Windows)



                      ssh -Y username@systemname -- omit this if using PuTTY --
                      echo $TERM
                      xterm


                      means that you can use GUI commands like opening the leafpad editor or nautilus file manager.



                      On the console it is the same:



                      Open terminal window
                      echo $TERM
                      xterm





                      share|improve this answer

























                      • TERM is not a variable that defines the default terminal emulator, but rather one that defines the capabilities of the current one. For example, setting the variable to "xterm-color" lets any program running in the terminal know that the current terminal is supposed to understand colours; setting it to "linux" tells programs that this is supposed to be a VT; etc.

                        – Cybolic
                        Dec 7 '17 at 0:54















                      -1














                      Simple answer. Works for both console or ssh.



                      Example for simple character terminal:



                      ssh username@systemname
                      echo $TERM
                      dumb


                      tells you that you can't open GUI apps on that connection



                      Example for xterm (also works with PuTTY/Xming on Windows)



                      ssh -Y username@systemname -- omit this if using PuTTY --
                      echo $TERM
                      xterm


                      means that you can use GUI commands like opening the leafpad editor or nautilus file manager.



                      On the console it is the same:



                      Open terminal window
                      echo $TERM
                      xterm





                      share|improve this answer

























                      • TERM is not a variable that defines the default terminal emulator, but rather one that defines the capabilities of the current one. For example, setting the variable to "xterm-color" lets any program running in the terminal know that the current terminal is supposed to understand colours; setting it to "linux" tells programs that this is supposed to be a VT; etc.

                        – Cybolic
                        Dec 7 '17 at 0:54













                      -1












                      -1








                      -1







                      Simple answer. Works for both console or ssh.



                      Example for simple character terminal:



                      ssh username@systemname
                      echo $TERM
                      dumb


                      tells you that you can't open GUI apps on that connection



                      Example for xterm (also works with PuTTY/Xming on Windows)



                      ssh -Y username@systemname -- omit this if using PuTTY --
                      echo $TERM
                      xterm


                      means that you can use GUI commands like opening the leafpad editor or nautilus file manager.



                      On the console it is the same:



                      Open terminal window
                      echo $TERM
                      xterm





                      share|improve this answer















                      Simple answer. Works for both console or ssh.



                      Example for simple character terminal:



                      ssh username@systemname
                      echo $TERM
                      dumb


                      tells you that you can't open GUI apps on that connection



                      Example for xterm (also works with PuTTY/Xming on Windows)



                      ssh -Y username@systemname -- omit this if using PuTTY --
                      echo $TERM
                      xterm


                      means that you can use GUI commands like opening the leafpad editor or nautilus file manager.



                      On the console it is the same:



                      Open terminal window
                      echo $TERM
                      xterm






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Aug 22 '17 at 21:35

























                      answered Aug 22 '17 at 21:23









                      SDsolarSDsolar

                      1,61451938




                      1,61451938












                      • TERM is not a variable that defines the default terminal emulator, but rather one that defines the capabilities of the current one. For example, setting the variable to "xterm-color" lets any program running in the terminal know that the current terminal is supposed to understand colours; setting it to "linux" tells programs that this is supposed to be a VT; etc.

                        – Cybolic
                        Dec 7 '17 at 0:54

















                      • TERM is not a variable that defines the default terminal emulator, but rather one that defines the capabilities of the current one. For example, setting the variable to "xterm-color" lets any program running in the terminal know that the current terminal is supposed to understand colours; setting it to "linux" tells programs that this is supposed to be a VT; etc.

                        – Cybolic
                        Dec 7 '17 at 0:54
















                      TERM is not a variable that defines the default terminal emulator, but rather one that defines the capabilities of the current one. For example, setting the variable to "xterm-color" lets any program running in the terminal know that the current terminal is supposed to understand colours; setting it to "linux" tells programs that this is supposed to be a VT; etc.

                      – Cybolic
                      Dec 7 '17 at 0:54





                      TERM is not a variable that defines the default terminal emulator, but rather one that defines the capabilities of the current one. For example, setting the variable to "xterm-color" lets any program running in the terminal know that the current terminal is supposed to understand colours; setting it to "linux" tells programs that this is supposed to be a VT; etc.

                      – Cybolic
                      Dec 7 '17 at 0:54

















                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f640096%2fhow-do-i-check-which-terminal-i-am-using%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Möglingen Índice Localización Historia Demografía Referencias Enlaces externos Menú de navegación48°53′18″N 9°07′45″E / 48.888333333333, 9.129166666666748°53′18″N 9°07′45″E / 48.888333333333, 9.1291666666667Sitio web oficial Mapa de Möglingen«Gemeinden in Deutschland nach Fläche, Bevölkerung und Postleitzahl am 30.09.2016»Möglingen

                      Virtualbox - Configuration error: Querying “UUID” failed (VERR_CFGM_VALUE_NOT_FOUND)“VERR_SUPLIB_WORLD_WRITABLE” error when trying to installing OS in virtualboxVirtual Box Kernel errorFailed to open a seesion for the virtual machineFailed to open a session for the virtual machineUbuntu 14.04 LTS Virtualbox errorcan't use VM VirtualBoxusing virtualboxI can't run Linux-64 Bit on VirtualBoxUnable to insert the virtual optical disk (VBoxguestaddition) in virtual machine for ubuntu server in win 10VirtuaBox in Ubuntu 18.04 Issues with Win10.ISO Installation

                      Antonio De Lisio Carrera Referencias Menú de navegación«Caracas: evolución relacional multipleja»«Cuando los gobiernos subestiman a las localidades: L a Iniciativa para la Integración de la Infraestructura Regional Suramericana (IIRSA) en la frontera Colombo-Venezolana»«Maestría en Planificación Integral del Ambiente»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«Conózcanos»«Caracas: evolución relacional multipleja»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»