Getting Started with Google Colab Beginner
In this lesson, you'll learn how to access Google Colab, navigate its interface, create your first notebook, run code cells, write documentation with Markdown, and master essential keyboard shortcuts.
Accessing Google Colab
Getting started with Colab takes just a few seconds:
-
Open Colab
Navigate to colab.research.google.com in your browser (Chrome, Firefox, Edge, or Safari).
-
Sign In with Google
Click "Sign in" and use your Google account. A free Gmail account works perfectly. Your notebooks will be saved to your Google Drive.
-
Create a New Notebook
Click File → New notebook or select "New Notebook" from the welcome dialog. A new
.ipynbfile is created in your Google Drive under "Colab Notebooks".
Interface Overview
The Colab interface has several key components:
- Menu Bar: File, Edit, View, Insert, Runtime, Tools, Help — standard operations and settings
- Toolbar: Quick-access buttons for adding cells, running code, and managing the notebook
- Code Cells: Write and execute Python code. Each cell can be run independently
- Text Cells: Write documentation and explanations using Markdown syntax
- Left Sidebar: Table of contents, file browser, code snippets, and variables inspector
- RAM/Disk Indicator: Shows current memory and disk usage in the top-right corner
- Runtime Status: Shows whether you're connected to a runtime and its type (CPU, GPU, TPU)
Creating Your First Notebook
Let's write and run your first code in Colab:
# Your first Colab code cell
print("Hello, Google Colab!")
# Basic arithmetic
x = 10
y = 20
print(f"The sum of {x} and {y} is {x + y}")
Click the Play button (or press Shift+Enter) to run the cell. The output appears directly below the cell.
# Import a library and create a quick visualization
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
y = np.sin(x)
plt.figure(figsize=(8, 4))
plt.plot(x, y, color='#4285F4', linewidth=2)
plt.title('Sine Wave in Google Colab')
plt.xlabel('x')
plt.ylabel('sin(x)')
plt.grid(True, alpha=0.3)
plt.show()
Running Code Cells
There are several ways to run code in Colab:
- Shift+Enter: Run the current cell and move to the next one
- Ctrl+Enter: Run the current cell and stay on it
- Alt+Enter: Run the current cell and insert a new cell below
- Play Button: Click the play icon to the left of any code cell
- Runtime → Run all: Run all cells in the notebook from top to bottom
Adding Text with Markdown
Text cells use Markdown syntax for formatting. Click + Text in the toolbar to add a text cell:
# Heading 1
## Heading 2
### Heading 3
**Bold text** and *italic text*
- Bullet point 1
- Bullet point 2
1. Numbered item
2. Another item
`inline code` and code blocks:
```python
print("Hello")
```
[Link text](https://example.com)
> Blockquote text
| Column 1 | Column 2 |
|----------|----------|
| Data 1 | Data 2 |
Essential Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Shift+Enter |
Run cell and move to next |
Ctrl+Enter |
Run cell and stay |
Alt+Enter |
Run cell and insert below |
Ctrl+M B |
Insert code cell below |
Ctrl+M A |
Insert code cell above |
Ctrl+M D |
Delete current cell |
Ctrl+M M |
Convert to text (Markdown) cell |
Ctrl+M Y |
Convert to code cell |
Ctrl+M Z |
Undo cell operation |
Ctrl+/ |
Comment/uncomment selected lines |
Ctrl+Shift+H |
Open keyboard shortcuts dialog |
Ctrl+S |
Save notebook |
Saving to Google Drive
Colab automatically saves your notebooks to Google Drive:
- Auto-save: Notebooks save automatically as you work
- Manual save: Press
Ctrl+Sor go to File → Save - Save a copy: File → Save a copy in Drive to duplicate the notebook
- Save to GitHub: File → Save a copy in GitHub to commit directly to a repository
- Download: File → Download → Download .ipynb to save a local copy
By default, notebooks are stored in the Colab Notebooks folder in your Google Drive root directory.
Lilly Tech Systems