Questions tagged [whoami]
14 questions
34
votes
2 answers
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 suspect he is being facetious)
who mom hates
There is…
spuder
- 17,643
- 36
- 91
- 119
14
votes
4 answers
`who am i` after `su` not showing new user id?
Why is it that when I switch user su 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
- 661
- 2
- 8
- 16
11
votes
2 answers
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 message (something on the line of "unknown…
A. N. Other
- 211
- 1
- 2
- 4
10
votes
3 answers
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 explain what exactly these commands do ? How are…
narendra-choudhary
- 808
- 2
- 8
- 15
9
votes
1 answer
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 " "
done
I…
whoami
- 93
- 1
- 4
8
votes
1 answer
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 differ in what they returned.
-bash-3.2$…
Keyshov Borate
- 1,301
- 5
- 16
- 34
8
votes
2 answers
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:pwd
so that I can quickly paste the output into…
Hooked
- 1,343
- 3
- 17
- 24
7
votes
2 answers
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 it in a variable called username.
It must take a…
NigerianWizard
- 93
- 1
- 4
5
votes
1 answer
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 command ?
What is - used for ?
I know su stands for…
Sachin Jain
- 153
- 6
1
vote
0 answers
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 if I su to root, I keep being whatever user I was…
vcedraz-
- 11
- 1
1
vote
1 answer
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 export -p and indeed the variable changed. I refreshed…
traveller
- 111
- 2
0
votes
1 answer
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 myUser return Changing password for…
GuillaumeRZ
- 103
- 1
- 4
0
votes
0 answers
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
...
ssh -t myserver << EOF
sudo /usr/bin/rootsh…
Ivo Babinec - Leo
- 41
- 2
0
votes
1 answer
$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 script will…
michaelsnowden
- 103
- 1
- 5