How can I change the password for a PostgreSQL user from the command line?

I need to update the password for a specific PostgreSQL user but I’m not sure of the proper way to do it from the command line or within psql. What’s the recommended method to change a PostgreSQL user password safely?