Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There are createuser & dropuser commands:

createuser - define a new PostgreSQL user account
dropuser - remove a PostgreSQL user account

Is there a corresponding way to list the user accounts?

These two commands do not require the user to invoke psql nor understand details of using it.

share|improve this question
    
    
@SailorCire, so, you apparently see no difference in the question you asked lmgtfy and the one I posted here. That is one of the niceties of so.com, questions and answers can be improved over time with feedback from others. – C.W.Holeman II May 6 '15 at 1:57
    
Yes, one of the goals of any SE is to become the Q&A for a certain topic; however, as per Help Center research should be done prior to asking as well as being specific. Your edit has now removed some ambiguity. – SailorCire May 6 '15 at 2:14

Use the psql shell and:

\deu[+] [PATTERN] such as:

postgres=# \deu+
      List of user mappings
 Server | User name | FDW Options 
--------+-----------+-------------
(0 rows)

And for all users:

postgres=# \du 
                              List of roles
 Role name  |                   Attributes                   | Member of 
------------+------------------------------------------------+-----------
 chpert.net |                                                | {}
 postgres   | Superuser, Create role, Create DB, Replication | {}

Also such as MySQL, you can do :

$ psql -c "\du"
                             List of roles
 Role name |                   Attributes                   | Member of 
-----------+------------------------------------------------+-----------
 chpert    |                                                | {}
 postgres  | Superuser, Create role, Create DB, Replication | {}
 test      |                                                | {}
share|improve this answer
8  
from terminal: psql -c '\du' – Frank Henard Oct 8 '15 at 17:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.