Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-11-2009, 03:55 PM   #1
Registered: May 2009
Posts: 32

Rep: Reputation: 15
Command to show ONLY super users

I've been messing around with BASH for a few months now, but I have come across a problem where I need to output ONLY the usernames of the super users. What command will do this? I tried searching all over Google, but found nothing.

Old 11-11-2009, 03:58 PM   #2
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
In general, there should only be one super-user on the system, root. You can print all users who have UID =0 in /etc/passwd with:

awk -F':' '($3 == 0) {print $1}' /etc/passwd

But there is usually only one name -- root. Note, this doesn't print users who might have sudo priviliges, you'd have to look in the /etc/sudoers file for that information.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Any super users out there? perry Linux - Newbie 4 10-28-2007 07:21 PM
Super Karamba - CPU temp no show andy-k Linux - Software 1 08-24-2007 05:13 PM
command to show all the login users sessions RajRed Linux - Newbie 3 04-18-2006 09:24 AM
How can I create super users tariq_ned Linux - General 2 03-06-2006 03:33 AM
Non Super Users can not access VFAT Partition shane25119 Linux - General 7 09-11-2004 11:25 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:26 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration