What does this command do?
sudo -u postgres psql
- Runs psql as the postgres user
- Creates a user named postgres
- Logs postgres out of all sessions
- Grants postgres sudo rights
sudo -u USER runs the command as that user instead of root.sudo -u postgres psql
sudo -u USER runs the command as that user instead of root.