- ssh into a DoC coputer using
ssh [email protected]
and enter password - create cw2.sql file and paste contents from this repo: copy text to be pasted to clipboard. Then run
vim cw2.txt
, hitv
to enable visual selection, use mouse wheel or arrow keys to select all the text, hitd
to delete, theni
to enter insert mode, andctrl+shift+v
to paste - run
psql -h db.doc.ic.ac.uk -d family_history -U lab -W -f cw2.sql -o cw2out.txt
to run queries - run
nano cw2out.txt
to see results
If you just want to type sql queries into the live shell, run psql -h db.doc.ic.ac.uk -d family_history -U lab -W
In the psql shell, when you are shown a faily large table, it will take you to a separate screen with just the table. To return to the shell hit q
.
To copy files over ssh, use scp
:
Localhost -> Remote host: scp /path/to/cw2.sql [email protected]:/some/remote/directory
Remote Host -> Localhost: scp [email protected]:/path/to/cw2.sql /some/local/directory
See http://www.hypexr.org/linux_scp_help.php for more