Notes: basic psql commands

As I’m learning postgresql to develop with Heroku, here are my notes on some of the basic commands that are necessary to move around within the command-line interface.

Logging in under the postgres user (this would be like root in mysql)
psql -U postgres -h localhost

To list all databases:
\list

To connect to a database (similar to use database in mysql):
\c the_database

To list tables in that database:
\d

To list the columns in a particular table:
\d table_name

To view all rows in a given connected table (just the standard sql command):
select * from the_table

To quit out of the psql command-line utility:
\q

Advertisements
Notes: basic psql commands

Solution: E: Could not get lock /var/lib/apt/lists/lock – open (11: Resource temporarily unavailable)

So occasionally I’ll end up closing out of an update or something else will happen and then next time I use my package manager, I’ll get an error something like this

E: Could not get lock /var/lib/apt/lists/lock – open (11: Resource temporarily unavailable)

Anyway, I’ve found a quick little trick to help this situation.  Type

sudo dpkg –install

And it usually shakes off the nonsense for me.  Don’t know why, but it does.

Solution: E: Could not get lock /var/lib/apt/lists/lock – open (11: Resource temporarily unavailable)