Resources
Sample code
Unix
- Copy file to and from my account on the CS Linux server "mirage".
scp moose.txt YOUR_USER_NAME@mirage.mathcs.carleton.edu:~/Desktop/moose.txt scp YOUR_USER_NAME@mirage.mathcs.carleton.edu:~/Desktop/moose.txt moose.txt
git
Core subcommands:
git status -- [USE THIS!] it tells you what's staged, modified, untracked, etc.
git add file -- stage the file so it will be added/updated on the next commit
git add directory -- stage all files in the directory for the next commit
git commit -m "message" -- commit staged changes with specified log message
git pull -- [DO THIS BEFORE PUSHING!!] grab the latest changes from
github's copy of the repo
git push -- send your committed changes to github's copy of the repo
Tags
git tag -a tagname -m "message" -- add a tag
git tag -a tagname -m "message" name -- add a tag pointing to the named commit
(e.g. name might be like
efe0b4018ed54bc1fc8dee579d71d1ff029f5287)
git push origin tagname -- push your tags to github
git tag --list -- list the existing tags
git tag -d tagname -- delete your local copy of the specified tag
git push origin --delete tagname -- delete the copy of the tag from github's copy
of the repo
psql basics
Launch psql with your postgresql user name:
psql -U user-name database-name
The psql prompt:
- includes the name of the database you're working on right now (e.g. "books=#" or "olympics=#")
- shows = when it's ready for a new \-directive or SQL query ("books=#")
- shows - when you're in the middle of an SQL query ("books-#")
The rest of these are "psql directives"—stuff you type at the psql prompt.
- \q [quit]
- \l [list all the available databases]
- \d [list all tables in the current database]
- \d+ [list all tables and sequences]
- \c dbname [switch to using the database dbname]
- \q [quit]
- \q [quit]
- \q [quit]
- \copy things FROM 'things.csv' DELIMITER ',' CSV NULL AS 'NULL'