Fetch today's material
nbgrader fetch phys202-2015 day03
assignment1 and http://codecademy.com@calpoly.edu) and password.The UNIX/LINUX terminal or shell provides a command line interface to a UNIX/LINUX computer. Bash is a common, and often default, programming language for the UNIX shell.
There are a couple of ways you can run terminal/bash command:
! in a Python kernel.To see the different terminal commands that are available on your system, you can use the ls command in the following direcot
In UNIX systems, the different commands you can run are typically put into various bin directories:
/usr/bin/usr/local/binHere are the commands in /usr/local/bin:
In [1]:
!ls /usr/local/bin
You can always find out where a command lives using which:
In [2]:
!which python2
In UNIX, files and directories are found according to their path. An example of a path is /usr/bin/python2 above. Some details about paths:
/ (unlike \ on Windows)/// and are relative to your current working directoryfoo is not the same as Foo or FOO). refers to the cwd.. refers to the parent of the cwd~ refers to your home directory* matches any pathYour current working directory can be found using pwd:
In [3]:
!pwd
In [4]:
!ls
List your home directory:
In [5]:
!ls ~
You can add the -l flag to show more details:
In [6]:
!ls -l ~
Files beginning with a . in their filename are hidden by default. You can show them using the -a flag:
In [7]:
!ls -a ~
Notice how your home directory has many hidden files. These are typically used to configure various programs on your system. You can edit these files in the notebook using a URL like the following:
/user/bgranger/edit/nfshome/bgranger/.bashrc
In [8]:
!touch testfile.py
The mkdir command is used to create a new empty directory:
In [9]:
!mkdir testdir
In [10]:
!ls
In [11]:
!rm testfile.py
To remove a directory, you have to add the -rf flags:
In [12]:
!rm -rf testdir
In [13]:
!ls
In [26]:
!touch foo.py
In [27]:
!ls
In [28]:
!cp foo.py foocopy.py
In [29]:
!ls
In [30]:
!rm foo.py foocopy.py
In [31]:
!ls
The mv command is used to move a file to a new location.
In [20]:
!tree -L 2 ~
In [21]:
!env
Notice how environment variables are typically UPPERCASE_WITH_UNDERSCORES. To set an env var, you need use the export command in one of the Bash configuration files:
.bashrc.bash_profileThe syntax looks like this:
export FOO=bar
Before the variable will show in env you have to restart Bash.
phys202-2015-work repo and clone locally.gitignoredays and assignments subdirectoriesPLEDGE.md to your phys202-2015-work and sign it..ipynb_checkpoints to your .gitignore fileProject Jupyter's nbgrader command will be used in this course to manage course content and assignments. It enables:
In order to use nbgrader, you need to know the course_id for your course.
The course_id for this course is phys202-2015.
To list the assignments in the nbgrader exchange for your course_id:
In [34]:
!nbgrader list phys202-2015
Now fetch the test assignment into your current working directory:
In [35]:
!nbgrader fetch phys202-2015 test
Note that this creates a directory of that name in the current working directory:
In [36]:
!ls
To submit a completed assignment to your instructor, you will first need to make sure you are in the parent directory of the assignment you want to submit. Put another way, if you want to submit the test assignment, you should see the test directory when you run ls.
Go ahead and submit the test assignment:
In [37]:
!nbgrader submit test phys202-2015
Each time you submit an assignment, it is timestamped with the current time. If you submit an assignment multiple times, your instructor will always see the most recent submission. These timestamps are also used to track late work.
In [38]:
!rm -r test
!ls
To practice using nbgrader fetch, use it to fetch the following bundles:
day01, day02, day03 into the days folder of your phys202-2015-work repo.assignment01 into the assignments folder of your phys202-2015-work repo.To verify that it has worked, run tree from the root directory of your phys202-2015-work repo.
Once you have the content in the right place, add and commit these changes to your git repo. Finally, push the changes to GitHub.
assignment01 by the begining of class on Wednesday.To submit assignment01 for grading, run the following from your assignments directory:
nbgrader submit assignment01 phys202-2015