Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [whoami]

The tag has no usage guidance.

9
votes
1answer
395 views

Different outputs for `w`, `who`, `whoami` and `id`

In command line platforms online, like for instance the one on Codecademy, when I run for cmd in w who whoami id do echo $cmd $cmd echo ========================= echo " " ...
6
votes
2answers
837 views

Using whoami to search for files that mention user

I'm currently working through some exercises to try and improve my shell scripting. The requirements of the script are as follows: It must get the user's name using the whoami command and store ...
0
votes
0answers
20 views

Checking if you are root user [duplicate]

A simple dumb check would be: if [ "$(whoami)" == "root" ]; then # i am the root user fi is there a better check that absolutely determines you are the root user, considering I suppose it might ...
7
votes
3answers
9k views

who, whoami, and “who am i”

I can understand the commands who and whoami, but what exactly happens when I type: who am i and who am I am on Ubuntu, nothing happens after them! Why doesn't Linux / UNIX reply with an error ...
0
votes
1answer
578 views

Using export USER=myName doesn't change the output of whoami

I saw this example $ whoami MatsP $ g++ -Wall -std=c++0x getenv.cpp $ ./a.out MatsP $ export USER=DonaldDuck $ ./a.out DonaldDuck but for me it doesn't work. I am in a Debian machine. I used ...
5
votes
1answer
3k views

Difference between logname and $LOGNAME

While reading about environment variables, the one I came across was LOGNAME, I'd like to know the difference between this variable and whatever the command logname returns - as both of them did ...
0
votes
1answer
3k views

$USER != whoami

I'm trying to re-install homebrew on my mac. I get this error: michaels-1856:~ michael.snowden$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ==> This ...
3
votes
3answers
41k views

Difference between who and whoami commands

The man page description of who command is who - show who is logged on But there exists a similar command whoami. The man page description of whoami is whoami - print effective userid Can anyone ...
5
votes
1answer
2k views

What does su - `whoami` command do?

I am running a script in my project and I see this command su - `whoami` I am having a few basic questions: What does this command do ? What is the significance of `` quotes outside the whoami ...
27
votes
2answers
6k views

Is `who mom likes` a real linux command?

I stumbled across a blog that mentioned the following command. who mom likes It appears to be equivalent to who am i The author warns to never enter the following into the command line (I ...
5
votes
1answer
14k views

A command that gives username@hostname:pwd

I know that pwd gives the current working directory, hostname gives the current host and whoami gives the current user. Is there a single unix command that will give me the output of whoami@hostname:...
8
votes
3answers
16k views

`who am i` after `su` not showing new user id?

Why is it that when I switch user su <username> and then execute who am i is outputs the previous user which I was logged as and not the one I've switched to?