Show Menu
Cheatography

Unix / git / SQL Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Unix

ls -alR
cd /path
pwd
mkdir name
rm -rd dir
cp file1 file2
mv file1 file2
touch filename
cat > file
more file
head / tail file
top
kill pid
ps # currently active processes
chmod 775 filename (4r 3w 1x)
grep pattern files / grep -r pattern dir
command | grep pattern
df / du # disk / dir
man command
gzip / gunzip file

Git

git init
git clone [url]
git status
git add [file]
git reset [file]
git diff
git diff --staged
git commit -m "message"
git branch
git branch [branch name]
git checkout
git merge [branch]
git log [branchB..branchA]
git rm [file]
git remote add [alias] [url]
git fetch [alias]
git merge [alias]/[branch]
git push [alias] [branch]
git pull
git reset --hard
 

SQL

CREATE TABLE table AS 
SELECT , DISTINCT column*, SUM(col) AS alias
FROM table
WHERE cond
GROUP BY var
HAVING cond
ORDER BY col [DESC]
LEFT JOIN tbl ON criteria

(CASE WHEN cond then 0 ELSE 1 END) AS variable
WHERE xx [NOT] LIKE pattern
WHERE xx [NOT] IN list
WHERE xx BETWEEN low AND high

COUNT(*), AVG(), MIN(), MAX(), SUM(), abs(), round(), floor(), ceiling()
substring(), lower(), upper(), ltrim()
dayname(), monthname(), dayofweek()