From 40f598f690e83f4aac954f5159d25d610f93bc93 Mon Sep 17 00:00:00 2001 From: Sarah Paetsch Date: Thu, 4 Jun 2015 18:29:39 -0700 Subject: [PATCH] Added Treehouse course notes --- sarah-paetsch/git_notes.txt | 96 +++++++++++++++++++++++ sarah-paetsch/unix_notes.txt | 146 +++++++++++++++++++++++++++++++++++ 2 files changed, 242 insertions(+) create mode 100644 sarah-paetsch/git_notes.txt create mode 100644 sarah-paetsch/unix_notes.txt diff --git a/sarah-paetsch/git_notes.txt b/sarah-paetsch/git_notes.txt new file mode 100644 index 0000000..e390c0b --- /dev/null +++ b/sarah-paetsch/git_notes.txt @@ -0,0 +1,96 @@ +Git Basics + +*** Ideas *** + +version control, source control, revision control + +repository +commit changes to repository + +why git? +designed by linux creator to manage development of that OS + +distributed version control system +access to "plumbing" +github community + +.git folder is where the history is stored + +master branch is trunk + +remote repositories +clone +push and pull + + +*** Commands *** + +git --version find out what version is installed + +git init create repository called +git init creates a new repository based on the current directory + +rm -r .git delete .git folder, which also removes repository + +git config --global user.name "" to set info re: user, for contact with team +git config --global user.email "
" + +git add add file to repo, adds to staging area +git commit commits file to repo, launches text editor to write comment +git commit -a -m "" commits all changed files with as comment + +git status status of files that are in progress +git log shows history of commits in repo + +git checkout checkout commit from history, identified for 1st six chars of ID + +git diff compare two commits + +git branch create a branch called bname +git checkout switch to that branch, checkout its head +git checkout -b create branch called bname and check it out +git branch lists all branches in project and shows which is current +git branch -D deletes the branch called bname. + +git merge merge bname into branch you are currently on, + will work automatically if there are no conflicts + if detects conflict, will fail and notify + proceed by opening file in conflict, inspect markers, choose change, save. run git add and git commit to add changes and resolve conflict. + +git clone make a local copy of the repo at loc + + +git remote shows the remote repository for the one you're currently in + if it is a clone, the copied repo will be called origin + +git remote add add a remote called name found at location loc + +git push send all changes from current repo to remote +git push origin add new branch called bname to origin + +git pull origin pull from origin to bname branch + can be used to resolve and merge locally first, just like merge + + assumes origin remote for push and pull + + +*** GitHub *** +pull request - ask owner to pull in your changes +fork - make your own copy + + +*** gitflow for branch management *** + +git flow feature start create a feature branch called +git flow hotfix start create a hotfix branch called +git flow hotfix finish close out the fix + + + + + + + + + + diff --git a/sarah-paetsch/unix_notes.txt b/sarah-paetsch/unix_notes.txt new file mode 100644 index 0000000..17ddaf2 --- /dev/null +++ b/sarah-paetsch/unix_notes.txt @@ -0,0 +1,146 @@ +*** Console Commands *** + +ls list contents of directory +ls -l long form version, more details +ls -a list all, including hidden files +ls / list contents of that directory + +clear clear screen + +pwd print working directory + +cd change directory, + cd ~ will go to home dir + cd .. will go one directory higher + +mv move or rename, files or directories +cp like mv, but leaves original in place + -r to do so recursively, for directories +rm removes a file or directory, no undo + -r to do so recursively, for directories +mkdir make directory + -p to create nested directories + +!! previous command + + +*** Looking at file contents *** + +less runs “less” to show file contents, arrow to scroll, spacebar by page + q to quit. “pager” + +cat for concatenating but can use to view contents + +nano to view and edit. ctrl key menu at bottom + + +*** Users *** + +whoami which user you're logged in as +sudo adduser add user, in special mode +su switch user +exit will go back to original user + + +*** Permissions *** + +chmod change permissions + chmod o+w = give Others the write permission + +chown needs sudo, chgs ownwer + +sudo switch to root user, super user + + +*** Processes *** + +top shows current running processes, interactive + ? will show help, like how to sort + q to quit + +ps show processes, return list + aux view all processes +ps aux | grep "top" will show all processes that match the grep for top + +jobs list jobs for current session, id's + & run a process and immediately put it in background +fg bring most recently paused job back to foreground + +kill kill process with that id#, clean up and exit +kill -KILL end immediately, can leave system in strange states +kill -STOP sends stop signal (pause) + + + +*** environment variables + +env shows environment variables +echo echo back stuff +echo $ will echo back value of environment variable + echo $HOME +$ specifies that you want to expand the env variable out + do not use $ when setting value +$PS1 prompt +export send variable to other processes +$PATH where it looks to run command, directory by directory + + + +find . -name "" starting in current directory, search down for file with name + returns path to file + +grep search inside a file for a pattern (regexp) +grep "is" hello.txt search for "is" in file hello.txt +grep -n "is" hello.txt provides line numbers for search results +grep -i case insensitive +grep -v lines that don't match +man grep manual for all options for grep + + + +*** installing *** +build and install from source vs. package manager + +sudo apt-get update updates package database +sudo apt-get install installs package +curl -O copy file from online location +tar -xvf decompress tar at this location + +1) ./configure run the configure program right here +2) make build program +3) sudo make install install + + +apt-cache search search package database for search term +sudo apt-get upgrade check for updates +sudo apt-get remove uninstall package + +*** Other Notes *** + +user | group | other: order of permissions +~ home directory +tab completion: shows autocomplete options for valid cd +bash: shell +read, write, execute: permissions +octal 0 thru 7 -- r=4, w=2, x=1 + +a job is a process that you own that you started from your console window +can pause/stop a job, ctrl-Z + +signal: message sent to a process by an OS +signal: TERM : terminate, clean up and exit ctrl-C + +standard in and standard out +piping output from one program as input to another with | +< redirection, route file into std input program +> output +>> redirect output to append to end of file +2> redirect std error output to file + +find / -name "sudoers" 2> /dev/null dump errors into junk file + +ps aux | grep bash | sort find all the processes called bash and sort them + + + +