Data Scientist's Toolbox Flashcards
Command Line Interface
A window in a computer where you can enter command lines and navigate the computer file structure by text and commands; git bash on Windows, and Terminal on Mac
Working Directory
Whatever directory you are currently in when using the Command Line Interface.
Path
All of the directories you need to navigate through to get back to your root directory from the directory you;re in now
Home Directory
The directory the command line interface opens into on your machine
Root Directory
The highest up the directory structure you can go. Nothing larger than this in your computer
pwd
A command that shows the path to the working directory you’re currently in. Stands for “print working directory”
The CLI Command recipe
command flags arguments
“command” is the CLI command that does a certain task
“flags” are options given to the command to trigger certain behaviours, proceeded by a “-“
“arguments” can be what the command is going to mod, or other options - not every command has these
Eg. pwd is a command with no flags or arguments
CLI Command: Clear
Clears up everything on the screen back to the home directory
CLI Command: ls
ls -a?
ls - al?
“ls” lists files and folders in the current directory
“ls -a” lists hidden and unhidden files and folders
“ls -l” lists details for files and folders in the current directory
“ls - al” lists details for hidden AND unhidden files and folders
-a and -l are flags
How to Id a hidden file or folder in the CLI
It will start with a “.” and only be visible with certain commands
CLI Command: cd
“cd” stands for “change directory”
“cd” accepts as an argument the directory you want to change to
“cd” with no argument goes back to the home directory
“cd ..” goes up one level in the directory path
What does “/” represent in the CLI?
The Root Directory
What does “ ~ “ represent in the CLI?
The Home directory
CLI Command: mkdir
“mkdir” stands for “make directory”
same as making a new folder in the GUI
mkdir accepts as an argument the name of the directory being created
CLI Command: touch
“touch” creates an empty file
“touch” accepts as an argument the name of the file being created
CLI Command: cp
“cp” stands for “copy”
“cp” takes as a first argument a file, and as a second argument (separated by a space) the name of the path to where the file should be copied
the “-r” (recursive) flag can also be used to indicate the contents of a directory should be copied to the new directory
CLI Command: rm
“rm” stands for “remove”
“rm” takes as an argument the name of a file you want to remove
“rm” can be modded with the flag “-r” and a directory as an argument to remove an entire directory (Note: this cannot be undone”
CLI Command: mv
“mv” stands for “move” and can be used to move a file from one directory to another
it accepts as an argument the name of the file to be moved
“mv” can also be used to rename files by using the desired filename as the second argument
CLI Command: echo
“echo” will print whatever arguments are provided after
Useful for printing out the contents of variables that have been stored
CLI command: date
“date” will print out the date
Adding to an index
“git add .” adds all new files
“git add -u” updates tracking for files that were renamed or deleted
“git add -a” does both of the previous
- should be done before committing
Committing to a local repository
“git commit -m “message” “ where “message” is a useful description of the work that was done
Note: this only updates the local repo, not the remote one
Pushing to Github
“git push” takes all changes made since last push and send them to github
Branch Commands
”- git checkout -b branchname” create a new branch named what is put in branch name
”- git branch” see what branch you are on
”- git checkout master” switch to the master branch