Command to know in which terminal we are located

This is a small tip, but sometimes it can help us with a task that we are doing, or simply ... it is always good to learn something new 😀

How do we know which terminal we are using?

We all know that if we run:

who

Something like:

kzkggaara pts / 0 2012-10-02 21:47 (: 0)
kzkggaara pts / 1 2012-10-02 23:07 (: 0)
kzkggaara pts / 2 2012-10-03 08:15 (: 0)
kzkggaara pts / 3 2012-10-03 09:08 (: 0)
kzkggaara pts / 5 2012-10-03 10:54 (: 0)

But, we cannot know exactly which terminal we are in, that is, in which one we execute the command ... to achieve this, we execute:

tty

This will tell us something like:

/ dev / pts / 31

And indeed, that is the terminal they are in 😀

And this has been all for this command, I have discovered more interesting in the system ... I'll put them here shortly 😀

regards


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Jose said

    And why don't you try "who am i"?
    For example :

    [jose @ portatil_hp ~] $ who am i
    jose pts / 1 2012-10-03 23:57

    1.    KZKG ^ Gaara said

      Interesting 😀
      Knew whoami … Which shows the nickname or userlogin, but I never tried to run it separately 🙂

      I said, in Linux we always have more ways of doing things than we know.
      Thanks for the tip 😉

    2.    msx said

      "Who am i"?
      Hahaha, take them, what movie did you get it from !?

      Please xD

      1.    KZKG ^ Gaara said

        Well it works 😉… as incredible as it may seem, IT WORKS! 😀

        1.    msx said

          What works is only the who 😉

      2.    Ivan Barra said

        From "Tron: Legacy"

  2.   Rayonant said

    Well, curious to me with who returns:
    david tty7 2012-10-03 20:11

    1.    proper said

      open several terminals and run it again 😉

    2.    KZKG ^ Gaara said

      I have several terminals open, it returns all of them, and if I want to know specifically in which one I typed the command, well, who gives me more data than I want 😀

  3.   elynx said

    Old acquaintance that good to know: D!

  4.   msx said

    As all character devices, the console accepts sequential feeding, try sending data directly to the device's address to see it on the screen in a transparent way 😀