mirror of
https://github.com/cheat/cheat.git
synced 2024-11-13 23:51:09 +01:00
Merge branch 'develop'
This commit is contained in:
commit
852db958a4
2 changed files with 36 additions and 0 deletions
|
@ -28,6 +28,16 @@
|
|||
Select a buffer CTRL-x b
|
||||
Run command in the scratch buffer CTRL-x CTRL-e
|
||||
|
||||
# Navigation ( backward / forward )
|
||||
|
||||
Character-wise CTRL-b , CTRL-f
|
||||
Word-wise ALT-b , ALT-f
|
||||
Line-wise CTRL-p , CTRL-n
|
||||
Sentence-wise ALT-a , ALT-e
|
||||
Paragraph-wise ALT-{ , ALT-}
|
||||
Function-wise CTRL-ALT-a , CTRL-ALT-e
|
||||
Line beginning / end CTRL-a , CTRL-e
|
||||
|
||||
# Other stuff
|
||||
|
||||
Open a shell ALT-x eshell
|
||||
|
|
26
cheat/cheatsheets/psql
Normal file
26
cheat/cheatsheets/psql
Normal file
|
@ -0,0 +1,26 @@
|
|||
# psql is the PostgreSQL terminal interface. The following commands were tested on version 9.5.
|
||||
# Connection options:
|
||||
# -U username (if not specified current OS user is used).
|
||||
# -p port.
|
||||
# -h server hostname/address.
|
||||
|
||||
# Connect to a specific database:
|
||||
psql -U postgres -h serverAddress -d dbName
|
||||
|
||||
# Get databases on a server:
|
||||
psql -U postgres -h serverAddress --list
|
||||
|
||||
# Execute sql query and save output to file:
|
||||
psql -U postgres -d dbName -c 'select * from tableName;' -o fileName
|
||||
|
||||
# Execute query and get tabular html output:
|
||||
psql -U postgres -d dbName -H -c 'select * from tableName;'
|
||||
|
||||
# Execute query and save resulting rows to csv file:
|
||||
psql -U postgres -d dbName -t -A -P fieldsep=',' -c 'select * from tableName;' -o fileName.csv
|
||||
|
||||
# Read commands from file:
|
||||
psql -f fileName
|
||||
|
||||
# Restore databases from file:
|
||||
psql -f fileName.backup postgres
|
Loading…
Reference in a new issue