DEV Community

Differences between `whoami`, `who` and `w` - Linux Tips

BC on January 09, 2020

whoami If I ssh to a linux server, and use whoami, it will print effective userid: $ whoami bo Enter fullscreen mode ...
Collapse
 
ghost profile image
Ghost

The cli is a more modern version of Alexa, you don't even have to talk to it, you just type it. And some of us are more comfortable writing than talking :)

Collapse
 
bitecode profile image
BC

haha, among the 3 big philosophy questions: "Who am I? Why am I here? Where do I find meaning?" Apparently cli is modern and smart enough to answer one of them - who am i -, it won't take long to answer the rest two. (I hope the answer is not 42) 😊

Collapse
 
ghost profile image
Ghost

It's kinda interesting tho, I'm not sure Adams was aware of the phenomena whein made the 42; with AI we put the question and get the answer, no clue about the process or rationale behind it; we'll know the answers not knowing why, historically the usual process was scientists discovered something and engineers behind looked for uses; that will probably invert in the future, engineers with AI will get answers and scientists behind will try to understand why did it work, like archeology. God indeed will work in misterious ways. And could it be a de-facto god if we made it? what would make us?, and to be this kind of all (or almost) know all "god" the AI needs to have what we see as concience? have to even pass the Turing test? could it be a dumb god? that knows everything but itself?...

... ok, that was way to much coffee for me, I'm gonna take a cold shower now.

Thread Thread
 
bitecode profile image
BC

that will probably invert in the future, engineers with AI will get answers and scientists behind will try to understand why did it work ...

I think it is already happening, one of my professor who has CS and Math background is working on explaining the deep learning network with Optimal Mass Transportation Theory, Convex Geometry and Monge-Ampere Equation.

Besides that, interesting thoughts 🤔

Collapse
 
tkdmzq profile image
TKDMzq

I never was so offended by something that I agree with. Some of us just can't talk to human beeings.

Collapse
 
ghost profile image
Ghost

hahaha, I fear the day AI gets "human" enough to make those interactions akward too :D

Collapse
 
moopet profile image
Ben Sinclair

Gonna throw finger into the mix?

Collapse
 
bitecode profile image
BC

oh, I never used finger before, thank you Ben for sharing this.

Seems it doesn't come with the default shell commands set, need to do apt install finger, and the output seems similar to w? Can you share more of the benefits using it compare to w if you don't mind?

Collapse
 
moopet profile image
Ben Sinclair

It used to be used all the time, but it's fallen out of favour. It's insecure, it was a plain-text client-server system so you could say finger ben@scramble.moopet.net or even just finger @scramble and it would interrogate the finger daemon on that host. If you set a file in your home directory called .plan it would display as part of the finger output:

$ finger teasmade@scramble.
Login: teasmade                 Name: Teasmade
Directory: /home/teasmade               Shell: /bin/bash
Last login Mon Feb 15 10:53 2016 (EST) on pts/0 from x.x.x.x
No mail.
Plan:
Make tea

There's a good overview of it here: computerhope.com/unix/ufinger.htm

Benefits include being able to query remote hosts, and being able to control what people can see about you by editing files in your home.

There's also the last command, which will give a listing of who was logged in:

$ last

moopet   pts/0        192.168.0.16     Sun Aug  4 19:20 - 19:21  (00:01)
moopet   pts/0        192.168.0.16     Sun Aug  4 19:19 - 19:20  (00:00)
reboot   system boot  5.2.5-arch1-1-AR Sun Aug  4 18:49 - 13:32 (10+18:43)
moopet   pts/0        192.168.0.16     Sun Aug  4 17:40 - 17:40  (00:00)
moopet   pts/0        192.168.0.16     Sun Aug  4 17:39 - 17:39  (00:00)
root     tty1                          Sun Aug  4 17:32 - 17:42  (00:09)
reboot   system boot  5.2.5-arch1-1-AR Sun Aug  4 17:32 - 17:42  (00:09)
Thread Thread
 
bitecode profile image
BC

I see, "being able to query remote hosts" this would be useful in some cases, gonna read more on it, thank you Ben :D

Collapse
 
codemouse92 profile image
Jason C. McDonald

This is really cool!

Collapse
 
bitecode profile image
BC

thank you Jason :D