Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use Ubuntu 12.04. I am logged-in to tty2, tty1 and tty7.

In my textbook I read that the whoami command allows me to determine which console I am using. But this command merely shows my login. As for the command who, it always lists tty2, tty1 and tty7. So, even the order of these consoles can't help me.

Could you help me how to determine the current console?

share|improve this question

migrated from stackoverflow.com Oct 1 '12 at 20:50

This question came from our site for professional and enthusiast programmers.

1  
How about the tty command? –  Joachim Isaksson Sep 30 '12 at 8:35
    
Improve your accept rate –  keyser Sep 30 '12 at 8:51
    
pls accept one of these answers so it won't show up as an unanswered question.. –  gokcehan Sep 30 '12 at 9:33
add comment

2 Answers

Use tty

$ tty
/dev/pts/1

Just remove the /dev/ and you've got it.

share|improve this answer
add comment

current:

$ tty | sed -e "s:/dev/::"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.