{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## The Shell\n", "\n", "adapted from Software Carpentry, The Hacker Within and other wonderful resources" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "##What is the Shell?\n", "\n", " * The Shell is a command processor that allows us to interact with the operating system. A Terminal lets us run a shell\n", " \n", " * You may have heard of some variations of the shell __csh__ (c-shell) , __tcsh__ (turbo c-shell), __bash__ (bourne-again shell)\n", " \n", " * I this course we will focus in __bash__ as it is most common, but the commands are very similar across all the shells\n", " \n", "http://en.wikipedia.org/wiki/Bash_(Unix_shell)\n", "\n", "\n", "##Why learn Shell or Command Line anyway?\n", "\n", " * __ubiquity__ : \n", " \n", " working in scientific computing you __will__ come across a command line interface sooner rather than later. It is the most basic interface to mose computer clusters and high performance hardware.\n", "\n", "\n", " * __power__ : \n", " \n", " Knowing shell commands gives you greater flexibility and options, and it gives you a method of creating reproducible scripts when working with data.\n", " \n", " \n", "Unix philosophy:\n", "**Make each program do one thing well**" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## So lets open a Terminal and get started!\n", "\n", "***\n", "\n", "Lets start with some basics, such as **Where am I?**, or how do I orient to where I am on the filesystem?\n", "\n", "Use the `pwd` command:\n", "\n", " pwd\n", "\n", "Can we just **print something to the terminal?** Yep, use `echo`:\n", "\n", " echo 'Hello'\n", "\n", "**Who am I?** \n", "When you log in to your computer, the system knows who you are (your username) \n", "\n", "Use the `whoami` command:\n", " \n", " whoami\n", "\n", "**What is in this directory?** \n", "To find out the contents of your current directory\n", "use the `ls` (short for list) command: \n", "\n", " ls" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Moving around, or changing directories\n", "`cd` by itself takes you to your home directory:\n", "\n", " cd\n", " pwd\n", "\n", "\n", "### Lets make a directory\n", "Once we are in your home directory, lets make a new directory to hold our bootcamp files\n", "To do this we use `mkdir` short for \"make directory\":\n", "\n", " mkdir bootcamp\n", "\n", "\n", "How do we move into this new directory? We use the \"relative\" path, and `cd`:\n", "\n", " cd bootcamp\n", " pwd\n", "\n", "To move back one directory: \n", "\n", " cd ../\n", " \n", "###Exercise:\n", "\n", "1. Type `pwd` , this gives you the **full path** to your current directory. Now check with your neighbor, what is their full path? \n", "2. If you are on the same operating system, how similar is it? \n", "3. If you are on a different operating system, how different is it?\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Full vs. Relative Paths\n", "\n", "The `cd` command takes an argument which is the directory\n", "name. Directories can be specified using either a *relative* path a\n", "full *path*. The directories on the computer are arranged into a\n", "hierarchy. The absolute path tells you where a directory is in that\n", "hierarchy. Navigate to the home directory. Now, enter the `pwd`\n", "command and you should see something like:\n", "\n", " /home/me\n", "\n", "which is the full name of your home directory. This tells you that you\n", "are in a directory called `me`, which sits inside a directory called\n", "`home` which sits inside the very top directory in the hierarchy. The\n", "very top of the hierarchy is a directory called `/` which is usually\n", "referred to as the *root directory*. So, to summarize: `me` is a\n", "directory in `home` which is a directory in `/`.\n", "\n", "Now enter the following command:\n", "\n", " cd /home/me/bootcamp\n", "\n", "This jumps to `bootcamp` directory. Now go back to the home directory. We saw\n", "earlier that the command:\n", "\n", " cd bootcamp\n", "\n", "had the same effect - it took us to the `bootcamp` directory. But,\n", "instead of specifying the absolute path\n", "(`/home/me/bootcamp`), we specified a *relative\n", "path*. In other words, we specified the path relative to our current\n", "directory. A absolute path always starts with a `/`. A relative path does\n", "not. You can usually use either a absolute path or a relative path\n", "depending on what is most convenient. If we are in the home directory,\n", "it is more convenient to just enter the relative path since it\n", "involves less typing.\n", "\n", "\n", "###Exercise:\n", "1. Now, list the contents of the `/bin` directory. Do you see anything\n", "familiar in there?\n", "2. How does it compare to your neighbor?\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Creating Files\n", "\n", "Use `cd` to go into your bootcamp directory and verify that is where you are.\n", "\n", " \n", "###Grab some files\n", "We have moved around and looked at a few things, lets add some files\n", "\n", "download [this](http://swcarpentry.github.io/2014-04-14-wise/advanced/shell/shelldata.zip)\n", "into your bootcamp directory and unzip\n", " \n", "### Bonus!! (OSX and Linux): \n", "You can use commands in the shell to grab the file\n", "\n", "OSX:\n", "```bash\n", " curl -O http://swcarpentry.github.io/2014-04-14-wise/advanced/shell/shelldata.zip\n", "```\n", "\n", "Linux:\n", "```bash\n", " wget http://swcarpentry.github.io/2014-04-14-wise/advanced/shell/shelldata.zip\n", "```\n", "You can use also use the command line call `unzip` to unzip the file:\n", "```bash\n", " unzip shelldata.zip\n", "```\n", "\n", "**NOTE** If you cannot or do not want to do the bonus, please just be sure you have downloaded the file into your bootcamp directory and unzipped the file\n", "\n", "\n", "###Use your skills to find the new files extracted from the zip file \n", "\n", "You will now have a new directory **data** that contains some files\n", "\n", "###Exercise\n", "\n", "1. move to the new **data** directory\n", "\n", "2. list contents (How many files are there?)\n", "\n", "3. move back into the bootcamp directory\n", "\n", "Previously we used **ls** to look at the contents of our working directory. Use **ls** to specifically look at **data**\n", "```bash\n", "ls data\n", "```\n", "4. What does it return and why?\n", "\n", "\n", "### Use **touch** to create an empty file\n", "\n", "To make an empty file use the `touch` command:\n", "\n", " touch emptyfile\n", "\n", "Now check that it exists using `ls`\n", "\n", "\n", "### Getting more info using ls\n", "\n", "Sometimes we want to have more information about the contents of a directory. We can use an argument to `ls` to get more information.\n", "\n", "Use **ls -l** in the bootcamp directory:\n", "\n", " ls -l\n", "\n", "What does this tell us about our files??\n", "This is what I get:\n", "```bash\n", "\n", " total 48\n", " drwxrwxr-x 5 cindeem staff 170 Apr 10 15:48 data\n", " -rw-r--r-- 1 cindeem staff 0 Apr 12 16:53 emptyfile\n", " -rw-r--r-- 1 cindeem staff 23581 Apr 12 16:43 shelldata.zip\n", "```\n", "### owner of file\n", "\n", "drwxrwxr-x 5 cindeem staff 170 Apr 10 15:48 data\n", "\n", "### group associated with the file\n", "\n", "drwxrwxr-x 5 cindeem staff 170 Apr 10 15:48 data\n", "\n", "\n", "### permissions\n", "Permissions tell you:\n", "\n", "* if an item is a directory\n", "\n", " drwxrwxr-x 5 cindeem staff 170 Apr 10 15:48 data\n", "\n", "* or a file\n", "\n", " -rw-r--r-- 1 cindeem staff 0 Apr 12 16:53 emptyfile\n", "\n", "\n", "The rest is permissions **r** for read, **w** for write, **x** for executable\n", "\n", "For owner, group, and everyone else\n", "\n", "drwxrwxr-x 5 cindeem staff 170 Apr 10 15:48 data\n", "\n", "###Exercise\n", "\n", "Using **ls -l**:\n", "\n", "1. which file is the largest?\n", "2. Which file(s) can be edited only by the owner? Why would this be useful?\n", "3. Look at the timestamp on the files? What does this information tell you?\n", "\n", "\n", "\n", "\n", "### man (short for manual)\n", "\n", "warning: If you are using gitbash, man will not work. gitbash has only implemented a limited number of commands. Share with a linux or OSX friend?\n", "\n", "So how do you find out about all the useful flags for a command?\n", "\n", "Prints out usage for a given command:\n", "\n", " man ls\n", "\n", "To move around in man\n", "\n", "* q (quit) To get out of man\n", "* arrow-down, arrow-up to navigate up and down\n", "* g (beginning of file), G (end of file)\n", "* / to search for pattern eg. /-t\n", "\n", "### Exercise\n", "1. Use `man ls` to find out how to list contents of a directory sorted in order of time modified\n", "2. Can you do the same thing (sort by time) in reverse order?\n", "3. Why would `ls -h` be useful?\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Removing files\n", "Make sure you are in the bootcamp directory, and remove the empty file you created previously\n", "```bash\n", "ls emptyfile\n", "rm emptyfile\n", "ls emptyfile\n", "```\n", "You should see this\n", "\n", "`ls: emptyfile: No such file or directory`\n", "\n", "Now try it with the data directory\n", "\n", "```bash\n", "ls \n", "rm data\n", "ls \n", "```\n", "\n", "What happened? Why? Why is this good?\n", "\n", "### Hidden Files\n", "Lets create a new file, but we are going to do something odd, we are going to add a **.** (dot or period) to the beginning of the\n", "filename:\n", "\n", " touch .hiddenfile\n", "\n", "If we use **ls** again this file will not show up, this is beacuse of the leading **.**\n", "\n", "However, we can see these files using the **-a** flag:\n", "\n", " ls -a\n", "\n", "\n", "We can now see the *hidden* file (.hiddenfile). Often these files are configuration files or temporary files, \n", "and in general you do not edit or work with them. \n", "But they will be useful to know about, and sometimes you do want to access them.\n", "\n", "#### Excercise\n", "\n", "1. There are usually many hidden files in your home directory, use ls -a to see them\n", "\n", "**Bonus** Use an absolute path instead of moving to your home directory\n", "\n", "2. One (or more) files in your home directory are configuration files for the bash shell, can you guess which one(s)?\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercising Power\n", "\n", "### Tab\n", "\n", "when using any command in a terminal, the terminal will try to guess what you are trying to do. To see how this works\n", "\n", "go into the bootcamp directory \n", "\n", "at the shell prompt enter **ls d [tab]**:\n", "\n", " ls d[tab]\n", "\n", "You should find it completed **data** for you (as this directory exists in the directory and is the only item that starts with\n", "**d** ).\n", "\n", "Now try this in the data directory \n", "\n", " ls data/d[tab]\n", " ls data/d[tab][tab]\n", "\n", "You had to hit the tab key twice. This is because there was not a **unique option**, instead there are multiple\n", "files that begin with **d**. Hitting tab twice shows your possible options. What do you think will happen if\n", "you try?\n", "\n", " ls di[tab]\n", "\n", "### What have you done? Use history\n", "\n", "When at an **empty prompt**, you can use your *up arrow* and *down arrow* to cycle through your previously used commands.\n", "This can save you alot of typing.\n", "\n", "In addition there is a *history* command which will print out the history of your recently used shell commands\n", "\n", " history\n", " \n", "### Excercise\n", " \n", "1. Why could history be useful?\n", "2. Remember your hidden files? Was there one that may hold history in it? Can you look into that file?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Reading Files\n", "Make sure you are in the **bootcamps/data** directory\n", "\n", "There should be a file called **dictionary.txt**. How do we read the contents of this file?\n", "\n", "### cat\n", "\n", "**cat** is a tool to concatenate or list files. Use cat to look at the contents of **dictionary.txt**\n", "\n", " cat dictionary.txt\n", "\n", "Thats alot of text...\n", "\n", "### head\n", "\n", "**head** allows us to look at just the first lines of a file\n", "\n", " head dictionary.txt\n", "\n", "### tail\n", "\n", "**tail** allows us to look at the last few lines of a file\n", "\n", " tail dictionary.txt\n", "\n", "### less \n", "Less allows you to view the contents of a text file, with control over \n", "navigating the file:\n", "\n", " less dictionary.txt\n", "\n", "to navigate:\n", "* **q** (short for quit) closes the file\n", "* **g** go to start of file\n", "* **G** go to end of file\n", "* you can also use *up-arrow* and *down-arrow*\n", "* **spacebar** scroll down page\n", "* **/** looks for pattern in file\n", "\n", "Side note:: cat, head, tail, and less are meant to be used to look at text files, not binary files. \n", "You will get unexpected results looking at binary files, but you will be able to see them. \n", "\n", "### Excercise\n", "\n", "1. use less and see if dictionary.txt contains *egg*\n", "2. use less to look at deidentified_assessment.csv\n", "3. use less to look at deidentified_assessment.xls\n", "\n", "\n", "**Note** sometimes it can be useful to use less to look at a binary file as many contain readable text, and can help you recognize if it is a valid file format.\n", "\n", "\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Copy Moving and Renaming\n", "\n", "### To copy a file, we use cp\n", "\n", "```bash\n", "cp dictionary.txt copied_dictionary.txt \n", "```\n", "\n", "This creates a new files with the same contents\n", "\n", "#### Copy a directory\n", "\n", "what if we wanted to make a copy of data, to data_copy?\n", "```bash\n", "cd ../\n", "cp data data_copy\n", "```\n", "This raises an error, why?\n", "\n", "To make this work we need to copy a directory **recursively**, and we do this using the **-r** flag\n", "\n", "```\n", "cp -r data data_copy\n", "```\n", "\n", "Check data_copy to see that it has the same files as data\n", "\n", "\n", "### What of we want to rename a file or move a directory?\n", "\n", "**mv** is used to `rename` or change the location of a file or directory. We will use it to rename the directory `data_copy`\n", "to `renamed_data`\n", "\n", "```bash\n", " mv data_copy renamed_data\n", "```\n", "\n", "Use `ls` to see that you have successfully renamed the directory\n", "\n", "**Note:** Move takes less time than copy for large files/directories. This is because copy (cp) **writes** newdata to disk while move (mv) just updates a pointer in the filesystem." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Searching for patterns using **grep**\n", "\n", "**grep** allows you to search for patterns \n", "\n", "### Stringing command together using (pipe) **|**\n", "\n", "Pipe **|** allows you to take output from one command and feed it into another command\n", "\n", "For example, we can use **cat** to list the contents of dictionary.txt, and then use the **pipe |**\n", "to send this to **grep** and look for words that contain **egg**\n", "\n", " cat dictionary.txt | grep egg\n", "\n", "To get all the words that start with **y** we use the carrot symbol **^**\n", "\n", " cat dictionary.txt | grep ^y\n", "\n", "Another option is the bracket **[ ]** which can allow you to look for multiple items.\n", "\n", "* [0-9] match any number\n", "* [a-c] match anything that has *a* or *b* or *c*\n", "\n", "For example, this allows us to find any lines that contain a x or a z\n", "\n", " cat dictionary.txt | grep [xz]\n", "\n", "### Exercise\n", "\n", "1. are there any lines in dictionary.txt that contain numbers?\n", "2. are there any lines in ex_data.txt that contain numbers?\n", "3. combine ls and grep with pipe to find all the directories in data that contain an **e**\n", "\n", "### Redirecting your output\n", "\n", "In the shell you can use **>** or **>>** to redirect output the a new file. This works a little like **pipe**\n", "(so note, if you are using a redirect, this is the one place you dont need an extra pipe)\n", "\n", "eg DO NOT do this: **cat file | >> newfile**\n", "\n", "To save output to a file, **>** puts output into a **new** file\n", "\n", " cat dictionary.txt > newdictionary\n", "\n", "To append to the end of the file, **>>** `appends` output to an existing file \n", "\n", " cat dictionary.txt >> newdictionary\n", "\n", "#### Exercise\n", "\n", "1. combine *cat*, *pipe*, and *redirect* to put all words starting with `g` in `dictionary.txt` \n", "into a new file **g_dictionary.txt**\n", "2. append all words that start with *h* in `dictionary.txt` to `g_dictionary.txt`, check with less\n", "3. *flashback* remove newdictionary \n", "\n", "### Counting things using wc\n", "\n", "**wc** stands for *word count*, and can be used to count words or lines.\n", "Lets see how many words are in **dictionary.txt** and then compare that to g_dictionary.txt\n", "\n", " wc dictionary.txt g_dictionary.txt\n", "\n", " 850 852 5321 dictionary.txt\n", " 54 54 318 g_dictionary.txt\n", " 904 906 5639 total\n", " \n", "* column 1 : number of newlines (850 for dictionary.txt, 54 for g_dictionary.txt, 904 combined)\n", "* column 2 : number of words (54 for g_dictionary.txt)\n", "* column 3 : number of characters in each file (318 in g_dictionary.txt, 5639 combined)\n", "\n", "You can also use this to count the number of items in a directory using the **-l** (for count lines) flag\n", "\n", " ls | wc -l\n", " \n", " 7\n", "\n", "### Wildcards\n", "\n", "**Wildcards** (*) are used to match anything, but we can use them to match specific things.\n", "\n", "Navigate to the `data` directory. USe a wildcard to find all the excel files\n", "\n", " ls *.xlsx\n", "\n", "This will give us everything in the directory\n", "\n", "\n", " ls *\n", "\n", "This command:\n", "\n", " ls /usr/bin/z*\n", "\n", "Lists every file in `/usr/bin` that starts with `z`. \n", "\n", "\n", "### Exercise\n", "\n", "Do each of the following using a single `ls` command without\n", "navigating to a different directory.\n", "\n", "1. List all of the files in `/bin` that **contain** the letters `sh`\n", "2. List all files in /bin that start with `d`\n", "3. (remember **grep** and **pipe**) List all files in `/bin` that start with `d` using grep\n", "\n", "\n", "###Bonus\n", "If you followed the install instructions, you should have installed anaconda for access to python and python libraries. One of the coolest tools you get with anaconda is **grin**. Grin wraps grep, and recursively looks into file(s) in a directory to find your matching pattern. Give this a try.\n", "\n", "cd to the bootcamp directory\n", "\n", "```bash\n", "grin egg\n", "```\n", "you should see something like this:\n", "\n", " ./data/dictionary.txt:\n", " 229 : egg\n", "\n", "**grin** found the pattern egg in the data directory in the dictionary.txt file. The pattern occurred on line 229. \n", "(Is that cool or what?)\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Environment information using env\n", "\n", "**env** prints your environment variables. Your system uses this to keep track of variables within and across programs.\n", "For example, lets find out who you are\n", "\n", " env | grep USER\n", "\n", "\n", "This gives us the username of the current user. Programs can take advantge of this to let us know who created certain\n", "files or ran different programs.\n", "\n", "The environment variable `PATH` is important for your computer to find executable programs\n", "\n", " env | grep PATH\n", "\n", "You will see there are a few env variables that have `PATH` in them, we want the simple one so we can do one of two\n", "things\n", "\n", "1. grep using **^** so it matches items that start with PATH\n", "2. remember when we used **echo**, we can combine **echo** with **$** to get the contents of environment variables \n", "\n", " env | grep ^PATH\n", "\n", " echo $PATH\n", "\n", "Your system uses the directories defined in `PATH` to find programs it can run.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Lets use our knowledge to do something useful!\n", "\n", "### Use git to grab files for the rest of the workshop\n", "\n", "You should have installed git as part of your pre-workshop installation.\n", "Type **git** at the prompt, what do you see?\n", "\n", "```bash\n", "\n", " git\n", " git --version\n", "```\n", "\n", "Now lets clone the repo for the advanced track\n", "\n", "* go to the bootcamp directory (use **cd**)\n", "\n", "* use git to clone the repo \n", "\n", "```bash\n", " git clone https://github.com/swcarpentry/2014-04-14-wise.git\n", "\n", "```\n", "\n", "###Exercise\n", "\n", "1. What files and directories have been created? \n", "2. What is the directory called?\n", "\n", "### Editing files with nano\n", "\n", "**nano** is a simple text editor, much like Microsoft Word is a text editor, but it is specially designed to work with code\n", "and scripts. Top open nano, you can just type `nano` at the command line.\n", "\n", " nano\n", "\n", "This will open a blank text editor. If you use the menu to open `dictionary.txt`, it will open the text file.\n", "\n", "All commands are at the bottom. To exit nano use Control-x.\n", "\n", "\n", "If you alreay use a different editor, feel free to use your editor of choice instead fo nano. But keep in mind nano exists on most systems, this will likely not work on Windows\n", "\n", "### Hidden files revisited\n", "\n", "Remember when we used `ls -a` to find hidden files. We are going to edit one of those hidden files. First go to your\n", "home directory (a quick way to do this is just type `cd` as it always takes you home. Use `pwd` to verify\n", "\n", " cd\n", " pwd\n", "\n", "\n", "We are going to update your bash resource file. \n", "\n", "###BONUS\n", "\n", "### .bashrc or .bash_profile\n", "\n", "The **.bashrc** or **.bash_profile file** in your home directory controls the behavior of your bash shell. \n", " This will not work with gitbash on Windows, apologies\n", "\n", "We want to add some magic to make working with git (source control) easier.\n", "\n", "####Link to a github repo to look at the file, we will download it below, this is just for information\n", "\n", "https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh\n", "\n", "\n", "###Lets get the file and make this work!\n", "\n", "1. download this file [git-prompt.sh](http://swcarpentry.github.io/2014-04-14-wise/advanced/shell/git-prompt.sh) into your home directory\n", "2. make it a hidden file (rename to .git-prompt.sh using mv )\n", "3. Use nano to open your .bashrc or .bash_profile config file\n", "4. Add these lines\n", "```\n", "source ~/.git-prompt.sh\n", "PS1='[\\u@\\h \\W$(__git_ps1 \" (%s)\")]\\$ '\n", "```\n", "\n", "**source** will execute the code in .git-prompt.sh which is a shell script\n", "\n", "the other line will update your prompt when you are working within a git repository\n", "\n", "Exit out of nano and save the file using Control-x\n", "\n", "\n", "##Exercise\n", "\n", "1. In your current shell , go back to the git repo you downloaded into bootcamp. Is anything different?\n", "\n", "2. Open a new terminal/shell, go to the same repo directory in the bootcamp directory. Now what do you see?\n", "Why might these be different?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Some Extra coolness in a ipython notebook\n", "\n", "You can use shell command in an ipython notebook. there are generally two methods\n", "\n", "*!* exclamation point before your command" ] }, { "cell_type": "code", "collapsed": false, "input": [ "!ls" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "To open an ipython notebook\n", "\n", "1. cd to the directory where the notebook is located\n", "2. ipython notebook\n", "\n", "This will open a webpage, and it will list the available notebooks\n", "\n", "Click on a notebook to open, and it will open in a tab\n", "\n", "###Basic commands (Keyboard shortcuts)\n", "* Shift-Enter to run a cell\n", "* Ctrl-Enter to run a cell in place\n", "* All other keyboard shortcuts have the form: Ctrl-m ?\n", "* Show all keyboard shortcuts using Ctrl-m h\n", "\n", "\n", "####Homework\n", "\n", "1. Before we meet again tomorrow, spend a little time going into the advanced repo directory, look for notebooks and see if you can open them.\n", "\n", "2. Download a copy of the notebook showing how to use shell magic linked at the top of [this page](http://nbviewer.ipython.org/github/ipython/ipython/blob/1.x/examples/notebooks/Cell%20Magics.ipynb) (Its the icon of an arrow pointing down)\n", "\n", "\n", "Not all magic will work for you, but understanding how to navigate the ipython notebook will help during the workshop tomorrow.\n", "\n", "\n", "### Lets try a little bash magic\n", "\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%%bash\n", "ls" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Shell.html\n", "Shell.ipynb\n", "git-prompt.sh\n", "shelldata.zip\n" ] } ], "prompt_number": 1 } ], "metadata": {} } ] }