{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Notebook Basics" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Running the Notebook Server" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The IPython notebook server is a custom web server that runs the notebook web application. Most of the time, users run the notebook server on their local computer using IPython's command line interface." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Starting the notebook server using the command line" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can start the notebook server from the command line (Terminal on Mac/Linux, CMD prompt on Windows) by running the following command: \n", "\n", " ipython notebook\n", "\n", "This will print some information about the notebook server in your terminal, including the URL of the web application (by default, `http://127.0.0.1:8888`). It will then open your default web browser to this URL.\n", "\n", "When the notebook opens, you will see the **notebook dashboard**, which will show a list of the notebooks, files, and subdirectories in the directory where the notebook server was started (as seen in the next section, below). Most of the time, you will want to start a notebook server in the highest directory in your filesystem where notebooks can be found. Often this will be your home directory." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Additional options" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "By default, the notebook server starts on port 8888. If port 8888 is unavailable, the notebook server searchs the next available port.\n", "\n", "You can also specify the port manually:\n", "\n", " ipython notebook --port 9999\n", "\n", "Or start notebook server without opening a web browser.\n", "\n", " ipython notebook --no-browser\n", "\n", "The notebook server has a number of other command line arguments that can be displayed with the `--help` flag: \n", "\n", " ipython notebook --help" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## The Notebook dashboard" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "When you first start the notebook server, your browser will open to the notebook dashboard. The dashboard serves as a home page for the notebook. Its main purpose is to display the notebooks and files in the current directory. For example, here is a screenshot of the dashboard page for the `examples` directory in the IPython repository:\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The top of the notebook list displays clickable breadcrumbs of the current directory. By clicking on these breadcrumbs or on sub-directories in the notebook list, you can navigate your file system.\n", "\n", "To create a new notebook, click on the \"New\" button at the top of the list and select a kernel from the dropdown (as seen below). Which kernels are listed depend on what's installed on the server. Some of the kernels in the screenshot below may not exist as an option to you.\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Notebooks and files can be uploaded to the current directory by dragging a notebook file onto the notebook list or by the \"click here\" text above the list.\n", "\n", "The notebook list shows green \"Running\" text and a green notebook icon next to running notebooks (as seen below). Notebooks remain running until you explicitly shut them down; closing the notebook's page is not sufficient.\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To shutdown, delete, duplicate, or rename a notebook check the checkbox next to it and an array of controls will appear at the top of the notebook list (as seen below). You can also use the same operations on directories and files when applicable.\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To see all of your running notebooks along with their directories, click on the \"Running\" tab:\n", "\n", "\n", "\n", "This view provides a convenient way to track notebooks that you start as you navigate the file system in a long running notebook server." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Overview of the Notebook UI" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you create a new notebook or open an existing one, you will be taken to the notebook user interface (UI). This UI allows you to run code and author notebook documents interactively. The notebook UI has the following main areas:\n", "\n", "* Menu\n", "* Toolbar\n", "* Notebook area and cells\n", "\n", "The notebook has an interactive tour of these elements that can be started in the \"Help:User Interface Tour\" menu item." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Modal editor" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Starting with IPython 2.0, the IPython Notebook has a modal user interface. This means that the keyboard does different things depending on which mode the Notebook is in. There are two modes: edit mode and command mode." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Edit mode" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Edit mode is indicated by a green cell border and a prompt showing in the editor area:\n", "\n", "\n", "\n", "When a cell is in edit mode, you can type into the cell, like a normal text editor." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "