NB: Windows users should look at the guide at the end of this document to install a terminal. Mac and Linux users already have one.

General explanation of the terminal

What is a terminal?

It’s a black screen that allows you to interact directly with your computer with some lines of code.

terminal

How to navigate into folders?

Write in the terminal “cd” and the name of the folder you want to access.

cd

On Windows, you can access ‘C:' or ‘D:' by adding the prefix /mnt/ :

mnt

How to navigate out of folder?

Write in the terminal “cd ..”

nav

Important tips

In order to move faster and avoid typo errors while navigating between folders, you should use Tab. You just need to start to type the file or directory name and once you wrote enough for it to be identified, you can press Tab.

If there is only one folder or file that starts with the characters you wrote, the name will be autocompleted. If there are many that start that way, you can press double Tab to list them; in order words, it is like using the command “ls” .

How to copy and paste to/from the terminal?

Copy and pasting depends on your Operating System.

  1. Windows: The commands to copy and paste in your Linux App in Windows is SHIFTRight Click and then select ‘Paste’ or ‘Copy’.
  2. MacOS: The commands to copy and paste for Mac are CMD C and CMDV
  3. Linux: The commands to copy and paste for Linux are CTRLSHIFTC and CTRLSHIFTD.

Copy pasting on Windows like in Linux: If you want to be able to CTRLSHIFTC and CTRLSHIFTD in your Linux App in Windows this is possible. You should first open your Ubuntu App, right click on the empty part of the title bar and click at ‘Properties’. Then, mark “Use Ctrl+Shift+C/V as Copy/Paste” and then click on “Ok”. For more information see here.

How to create a folder?

Write in the terminal “mkdir” and add the name of the folder.

mkdir

How to know where I am?

By writing “pwd”, the terminal will tell you where you are; in other words, the file directory you are working on.

pwd

How to display files?

Write “ls” in your terminal it will list your files.

ls

How to copy a folder?

Write in the terminal “cp” with the file you want to copy and add the final destination folder where you want to paste it.

cp

Git and conda in terminal

Cloning fastai repository (Download the fastai files)

Go to this url: https://github.com/fastai/fastai, and copy the git url. Click on the number 1 and 2 to have it on your clipboard.

clone

Then, in order to clone the fastai repo, use the friendly command “git clone” and then paste the url your terminal.(If you’re using Colab, you need to add “!” before the command to use Shell)

paste

Updating your fastai repository (Downloading the missing files)

Enter the “/fastai” directory you’ve just cloned, when your repo is up-to-date, you should see this message.

pull1

If there are new missing files, you wil see this.

pull2

Updating Conda

One more thing, if you want to update conda, you should write this in the terminal “conda update conda” and you are done.

update


Getting a terminal on Windows

Windows 10

For Windows users, you will need to install a terminal with the bash shell (Mac and Linux already have one). Note that this is only necessary if you don’t use one of the ready-to-run Jupyter options for the course.

We recommand Windows Subsystem for Linux (WSL) and the Ubuntu App for Windows 10 users. To install it, note that you first need to activate WSL with the following steps:

  1. Open the Control Panel
  2. Select ‘Programs’
  3. Click on ‘Turn Windows features on or off’
  4. Scroll and click next to ‘Windows Subsystem for Linux’
  5. Reboot your computer

Turn WSL on

Once this is done, you just have to install Ubuntu from the Windows Store and launch the app. Note that this is a full Ubuntu installation running inside Windows! So when installing software for use in this environment, you should follow steps for Ubuntu, not for Windows. It’s very useful to be able to copy/paste with keyboard shortcuts in your WSL terminal; here’s how to enable that:

  1. Right click on the title bar
  2. Click “Properties”
  3. Check “Use ctrl+shift+c/v as Copy/Paste”.

Windows XP, 7, and 8

For older versions of Windows, we recommend installing Cygwin. If you’re using Google Cloud, you should install the Windows version, not the Ubuntu version.

Many thanks to Kevin Martell for writing the first draft of this guide.