Skip to main content

Questions tagged [whoami]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
1k views

command whoami and echo $USER are giving different outputs how is that even possible?

If I don't fix this I can't properly run bash scripts that checks whether the $USER is root in an IF statement, because, as it is, the $USER is never root, even when the whoami is the root. No matter ...
vcedraz-'s user avatar
0 votes
1 answer
3k views

Why whoami always returning "root"?

After a hack, a dedicated server always return "root" following whoami command. Even after a sudo su myUser > whoami return "root". myUser exists on the server, because regarding this issue passwd ...
GuillaumeRZ's user avatar
0 votes
0 answers
583 views

In script : ssh and then sudo rootsh root

Can't find the solution. I need in the script - ssh to a server then change to root via sudo /usr/bin/rootsh -i -u root. Then make some action then go back and carry on with script... Something like ....
Ivo Babinec - Leo's user avatar
9 votes
1 answer
3k 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 " " ...
whoami's user avatar
  • 93
7 votes
2 answers
10k 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 ...
NigerianWizard's user avatar
11 votes
2 answers
24k 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 ...
A. N. Other's user avatar
1 vote
1 answer
2k 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 ...
traveller's user avatar
  • 111
9 votes
1 answer
11k 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 ...
Keyshov Borate's user avatar
0 votes
1 answer
6k 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 ...
michaelsnowden's user avatar
10 votes
3 answers
58k 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 ...
narendra-choudhary's user avatar
5 votes
1 answer
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 ...
Sachin Jain's user avatar
34 votes
2 answers
10k 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 ...
spuder's user avatar
  • 18.3k
9 votes
2 answers
27k 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:...
Hooked's user avatar
  • 1,373
14 votes
4 answers
23k 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?
user1091856's user avatar