The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Running script from other user rather than login user rawatds Shell Programming and Scripting 3 01-30-2009 01:18 PM
User not able to login directly using ssh sag71155 HP-UX 2 03-26-2008 08:53 AM
I create user but i cant login the user i created. jerome UNIX for Dummies Questions & Answers 5 06-09-2006 05:08 PM
New user can't login here2learn UNIX for Dummies Questions & Answers 3 02-18-2004 09:13 PM
Login User olli2002 UNIX for Advanced & Expert Users 6 08-27-2002 10:15 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-17-2008
jakSun8 jakSun8 is offline
Registered User
  
 

Join Date: Dec 2007
Location: Gotham City
Posts: 59
How to find user/login id?

It seems like not all Unix have whoami. What is the alterate way to display just the login id?

Any help is appreciated
jak
  #2 (permalink)  
Old 03-17-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
Most shells have a USER envrionment variable.
Code:
echo $USER
  #3 (permalink)  
Old 03-17-2008
theninja theninja is offline
Registered User
  
 

Join Date: Jan 2008
Location: St. Louis
Posts: 50
try using id
  #4 (permalink)  
Old 03-17-2008
jakSun8 jakSun8 is offline
Registered User
  
 

Join Date: Dec 2007
Location: Gotham City
Posts: 59
Thanks .. i will try it out.
  #5 (permalink)  
Old 03-17-2008
jakSun8 jakSun8 is offline
Registered User
  
 

Join Date: Dec 2007
Location: Gotham City
Posts: 59
FYI, I stumbled upon 'logname' command and it gave me the user id.

Thanks,
jak
  #6 (permalink)  
Old 03-18-2008
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
if you login as jdoe and then do su - tclark, then echo $USER and logname differ in their output

echo $USER would show tclark while logname would tell you jdoe
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:35 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0