Start the cell with %%bash
and Jupyter will treat the whole cell as a script.
%%bash
cowsay "Welcome to Jupyter"
uname
____________________ < Welcome to Jupyter > -------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || Darwin
Prefix a line with !
to let Jupyter know that it's a shell command.
!uname
Darwin
After executing %load <filename>
, the content of the file is loaded, and the load command is automatically commented.
# %load hello.py
print('Hello from Python')
Hello from Python
While in Command
mode, type M.
?sorted
Signature: sorted(iterable, /, *, key=None, reverse=False) Docstring: Return a new list containing all items from the iterable in ascending order. A custom key function can be supplied to customize the sort order, and the reverse flag can be set to request the result in descending order. Type: builtin_function_or_method
%lsmagic
Available line magics: %alias %alias_magic %autoawait %autocall %automagic %autosave %bookmark %cat %cd %clear %colors %conda %config %connect_info %cp %debug %dhist %dirs %doctest_mode %ed %edit %env %gui %hist %history %killbgscripts %ldir %less %lf %lk %ll %load %load_ext %loadpy %logoff %logon %logstart %logstate %logstop %ls %lsmagic %lx %macro %magic %man %matplotlib %mkdir %more %mv %notebook %page %pastebin %pdb %pdef %pdoc %pfile %pinfo %pinfo2 %pip %popd %pprint %precision %prun %psearch %psource %pushd %pwd %pycat %pylab %qtconsole %quickref %recall %rehashx %reload_ext %rep %rerun %reset %reset_selective %rm %rmdir %run %save %sc %set_env %store %sx %system %tb %time %timeit %unalias %unload_ext %who %who_ls %whos %xdel %xmode Available cell magics: %%! %%HTML %%SVG %%bash %%capture %%debug %%file %%html %%javascript %%js %%latex %%markdown %%perl %%prun %%pypy %%python %%python2 %%python3 %%ruby %%script %%sh %%svg %%sx %%system %%time %%timeit %%writefile Automagic is ON, % prefix IS NOT needed for line magics.
%run hello.py
Hello from Python
%%HTML
<marquee>This is HTML</marquee>
%%ruby
puts('Hello Ruby')
Hello Ruby
%%javascript
console.log("Hello JavaScript")
input()
'123'