For some reason, I can never remember how to do this.
If you ever want to grep for something but leave out a particular directory, use the
So if I wanted to search the current directory for the string img, but don’t want to look in the directories tmp or log.
grep -r --exclude-dir=log --exclude-dir=tmp "img" ./
if you want to import a csv to a heroku table, execute the following command:
psql `heroku config:get DATABASE_URL -a your_app`?ssl=true -c "\copy your_table FROM '/tmp/rows.csv' WITH CSV;"
your_app with the appropriate info
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:
To connect to a database (similar to
use database in mysql):
To list tables in that database:
To list the columns in a particular table:
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: