Commit 2e3948f8 authored by Éamonn Murray's avatar Éamonn Murray

Add some info on magics

parent 562bdc6a
......@@ -168,3 +168,27 @@ Note shortcuts are not case sensitive.
- `Ctrl+S` : Save and Checkpoint
- `Down` : move cursor down
- `Up` : move cursor up
Jupyter, when used with the ipython kernel, has a long list of special built
in commands it understands that allow you to do some fairly complex things
with a single command. These are divided into line magics, which perform or
wrap a single command, and cell magics which apply to an entire cell. Line
magics are usually preceded by a `%` symbol (although there is a setting called
Automagic which is usually enabled and allows them to be entered without
this), while cell magics are preceded by `%%`. Here are a few useful ones:
- `%lsmagic` - list all magic commands. This will also tell you if Automagic
is enabled.
- '%who' - list all the interactive variables. Additionally `%who_ls` will
return the variables as a sorted list, and `%whos` will return some
additional information about each variable.
- '%system` or `%sx` - execute a system command. For exampled `%sx ls` will
list all files in the current directory. This can also be done by
beginning a line with `!!`, e.g. `!!ls`.
- `%time` or `%%time` - time the execution of an expression or cell, returning
both the cpu time and wall time.
- '%timeit` or `%%timeit` - analyse the time taken for the execution of
an expression or cell. This will perform the expression a number of times
and return some statistics about the time taken.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment