Skip to main content

Different outputs for `w`, `who`, `whoami` and `id` [Resolved]

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 get

w                                                                                                   
00:52:54 up 8 days, 14:10,  0 users,  load average: 3.78, 2.98, 2.69                               
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT                                 
=========================                                                                           
                                                                                                    
who                                                                                                 
=========================                                                                           
                                                                                                    
whoami                                                                                              
ccuser                                                                                              
=========================                                                                           
                                                                               
id                                                                        
uid=1000(ccuser) gid=1000(ccuser) groups=1000(ccuser)                          
=========================                                                                    

Note that only whoami and id output something. When I run the same thing on my computer, I see similar results for all commands.

Why doesn't Codecademy display the user for w and who? What's different about these commands?


Question Credit: whoami
Question Reference
Asked March 17, 2019
Tags: users, whoami
Posted Under: Unix Linux
20 views
1 Answers

Your Answer