> This page location: Roles & Privileges > List Roles
> Full Neon documentation index: https://neon.com/docs/llms.txt

# PostgreSQL List Users

**Summary**: in this tutorial, you will learn how to use the PostgreSQL list user command to show all users in a PostgreSQL database server.

## Listing users using the psql tool

First, [connect to the PostgreSQL database server](../postgresql-jdbc/connecting-to-postgresql-database) using the `postgres` user:

```bash
psql -U postgres
```

It will prompt you for a password:

```
Password:
```

Once you enter the password for the `postgres` user, you will see the following PostgreSQL command prompt:

```
postgres=#
```

Second, use the `\du` to list all user accounts (or roles) in the current PostgreSQL database server:

```
\du
```

![](https://neon.com/postgresqltutorial/PostgreSQL-List-User-Example-1.png)If you want to show more information, you can use the `\du+` command:

```
postgres=#\du+
```

The `\du+` command adds column called `description`.

## Listing users using SQL statement

The following statement returns all users in the current database server by [querying data](../postgresql-tutorial/postgresql-select) from the `pg_catalog.pg_user` catalog:

```sql
SELECT usename AS role_name,
  CASE
     WHEN usesuper AND usecreatedb THEN
	   CAST('superuser, create database' AS pg_catalog.text)
     WHEN usesuper THEN
	    CAST('superuser' AS pg_catalog.text)
     WHEN usecreatedb THEN
	    CAST('create database' AS pg_catalog.text)
     ELSE
	    CAST('' AS pg_catalog.text)
  END role_attributes
FROM pg_catalog.pg_user
ORDER BY role_name desc;
```

![](https://neon.com/postgresqltutorial/PostgreSQL-List-User-Using-SQL-example.png)

## Summary

- Use `\du` or `\du+` psql command to list all users in the current database server.
- Use the `SELECT` statement to query the user information from the `pg_catalog.pg_user` catalog.

---

## Related docs (Roles & Privileges)

- [Create Roles](https://neon.com/postgresql/postgresql-administration/postgresql-roles)
- [Grant Privileges](https://neon.com/postgresql/postgresql-administration/postgresql-grant)
- [Revoke Privileges](https://neon.com/postgresql/postgresql-administration/postgresql-revoke)
- [Alter roles](https://neon.com/postgresql/postgresql-administration/postgresql-alter-role)
- [Drop Roles](https://neon.com/postgresql/postgresql-administration/postgresql-drop-role)
- [Role Membership](https://neon.com/postgresql/postgresql-administration/postgresql-role-membership)
- [SET ROLE Statement](https://neon.com/postgresql/postgresql-administration/postgresql-set-role)
- [CURRENT_USER](https://neon.com/postgresql/postgresql-administration/postgresql-current_user)
- [Change Password](https://neon.com/postgresql/postgresql-administration/postgresql-change-password)
- [Create Superusers](https://neon.com/postgresql/postgresql-administration/create-superuser-postgresql)
- [PostgreSQL Row-Level Security](https://neon.com/postgresql/postgresql-administration/postgresql-row-level-security)
