Guide for managing Google NotebookLM from the command line using nlm CLI. Use when the user wants to create notebooks, manage sources, generate audio overviews, or mentions NotebookLM, nlm, notebook management, or research organization.
This skill helps you interact with Google's NotebookLM from the command line using the nlm CLI tool. Manage notebooks, sources, notes, and generate audio overviews efficiently.
Basic workflow for using NotebookLM CLI:
nlm authnlm create <title>nlm add <notebook-id> <input>nlm is a command-line interface for Google's NotebookLM that enables:
Before using nlm commands, authenticate with Google:
nlm auth
This command:
Re-authentication:
Run nlm auth again if:
View all your notebooks:
nlm list
# or shorthand
nlm ls
Output includes:
Filtering examples:
# List recent notebooks
nlm ls | head -n 10
# Search by title pattern
nlm ls | grep "Research"
Create a new notebook:
nlm create "Research Project Title"
Best practices:
"2024-Q4: Market Analysis"Returns:
Example workflow:
# Create and capture ID
NOTEBOOK_ID=$(nlm create "AI Ethics Research" | grep -oE '[a-f0-9-]{36}')
echo "Created notebook: $NOTEBOOK_ID"
Remove a notebook permanently:
nlm rm <notebook-id>
Warning: This action is irreversible and deletes:
Safe deletion workflow:
# Review before deletion
nlm analytics <notebook-id>
nlm sources <notebook-id>
# Confirm and delete
nlm rm <notebook-id>
View usage statistics:
nlm analytics <notebook-id>
Metrics include:
Use cases:
View all sources in a notebook:
nlm sources <notebook-id>
Output details:
Sorting and filtering:
# Most recent sources
nlm sources <notebook-id> | head -n 5
# Find specific source type
nlm sources <notebook-id> | grep "PDF"
Add content to a notebook:
nlm add <notebook-id> <input>
Supported input types:
URL/webpage:
nlm add <notebook-id> "https://example.com/article"
Local file:
nlm add <notebook-id> "/path/to/document.pdf"
nlm add <notebook-id> "/path/to/notes.txt"
Text content:
nlm add <notebook-id> "Direct text content to add as source"
Multiple sources:
# Add multiple URLs
for url in $(cat urls.txt); do
nlm add <notebook-id> "$url"
sleep 2 # Rate limiting
done
Supported file formats:
Delete a source from notebook:
nlm rm-source <notebook-id> <source-id>
Workflow:
# List sources to find ID
nlm sources <notebook-id>
# Remove specific source
nlm rm-source <notebook-id> <source-id>
# Verify removal
nlm sources <notebook-id>
Note: This does not affect notes or other sources referencing the deleted source.
Change source display name:
nlm rename-source <source-id> "New Source Name"
Best practices:
"Q3 2024 Financial Report""API Documentation v2.1""Interview Transcript - Dr. Smith"Example:
# Generic URL becomes readable
nlm rename-source <source-id> "McKinsey AI Report 2024"
Update source content from origin:
nlm refresh-source <source-id>
Use cases:
Note: Only works for sources with accessible origin URLs (not uploaded files).
Verify if source content is current:
nlm check-source <source-id>
Returns:
Monitoring workflow:
# Check all sources in notebook
for source in $(nlm sources <notebook-id> | awk '{print $1}'); do
nlm check-source $source
done
View all notes in a notebook:
nlm notes <notebook-id>
Output includes:
Add a new note to notebook:
nlm new-note <notebook-id> "Note Title"
Returns:
Workflow:
# Create note and capture ID
NOTE_ID=$(nlm new-note <notebook-id> "Meeting Notes" | grep -oE '[a-f0-9-]{36}')
# Add content immediately
nlm edit-note <notebook-id> $NOTE_ID "Meeting summary content..."
Update note content:
nlm edit-note <notebook-id> <note-id> "Updated content here"
Content handling:
Examples:
# Simple update
nlm edit-note <notebook-id> <note-id> "New findings from research."
# Multi-line with heredoc
nlm edit-note <notebook-id> <note-id> "$(cat <<EOF
# Research Findings
## Key Insights
- Finding 1
- Finding 2
## Next Steps
- Action items here
EOF
)"
Delete a note:
nlm rm-note <note-id>
Warning: Permanent deletion - cannot be recovered.
Generate AI audio discussion:
nlm audio-create <notebook-id> "Instructions for audio generation"
Instructions guide the AI hosts:
"Focus on methodology and findings""Explain for non-technical audience""Conversational and engaging tone""Create 5-minute overview""Emphasize practical applications"Examples:
# Research summary
nlm audio-create <notebook-id> "Create engaging overview of key findings for general audience"
# Technical deep-dive
nlm audio-create <notebook-id> "Technical analysis of methodologies and data, 10 minutes"
# Comparative analysis
nlm audio-create <notebook-id> "Compare approaches across all sources, highlight differences"
Processing:
nlm audio-getRetrieve generated audio:
nlm audio-get <notebook-id>
Returns:
Download workflow:
# Get audio URL
AUDIO_URL=$(nlm audio-get <notebook-id> | grep -o 'https://.*\.mp3')
# Download audio
curl -o "notebook-audio.mp3" "$AUDIO_URL"
Remove generated audio:
nlm audio-rm <notebook-id>
Use cases:
Regeneration workflow:
# Remove old audio
nlm audio-rm <notebook-id>
# Generate new with updated instructions
nlm audio-create <notebook-id> "New instructions here"
Get shareable link:
nlm audio-share <notebook-id>
Returns:
Privacy notes:
Create comprehensive guide from sources:
nlm generate-guide <notebook-id>
Output:
Use cases:
Create structured outline:
nlm generate-outline <notebook-id>
Output format:
Applications:
Create focused content section:
nlm generate-section <notebook-id>
Interactive prompts for:
Use cases:
Run commands from file:
nlm batch <commands-file>
Command file format:
create "Research Project"
add $NOTEBOOK_ID "https://example.com/article1"
add $NOTEBOOK_ID "https://example.com/article2"
add $NOTEBOOK_ID "/path/to/document.pdf"
generate-guide $NOTEBOOK_ID
audio-create $NOTEBOOK_ID "Create engaging overview"
Best practices:
Complex batch example:
# batch-commands.txt
create "Market Research Q4 2024"
add $NOTEBOOK_ID "https://reports.example.com/q4"
add $NOTEBOOK_ID "https://analysis.example.com/trends"
add $NOTEBOOK_ID "/data/survey-results.pdf"
new-note $NOTEBOOK_ID "Executive Summary"
generate-outline $NOTEBOOK_ID
audio-create $NOTEBOOK_ID "Focus on key trends and recommendations"
Execution:
nlm batch batch-commands.txt
Complete notebook initialization:
#!/bin/bash
# Create notebook
NOTEBOOK_ID=$(nlm create "Research: AI Ethics 2024" | grep -oE '[a-f0-9-]{36}')
echo "Created notebook: $NOTEBOOK_ID"
# Add primary sources
nlm add $NOTEBOOK_ID "https://arxiv.org/paper1"
nlm add $NOTEBOOK_ID "https://arxiv.org/paper2"
nlm add $NOTEBOOK_ID "/research/literature-review.pdf"
# Create organizational notes
nlm new-note $NOTEBOOK_ID "Research Questions"
nlm new-note $NOTEBOOK_ID "Methodology Notes"
nlm new-note $NOTEBOOK_ID "Key Findings"
# Generate initial guide
nlm generate-guide $NOTEBOOK_ID
echo "Setup complete! Notebook ID: $NOTEBOOK_ID"
Regular maintenance workflow:
#!/bin/bash
NOTEBOOK_ID="your-notebook-id"
# Check source freshness
echo "Checking source freshness..."
for source in $(nlm sources $NOTEBOOK_ID | awk '{print $1}'); do
nlm check-source $source
done
# Refresh outdated sources
echo "Refreshing outdated sources..."
# (add logic based on check-source output)
# Verify all sources loaded
echo "Source status:"
nlm sources $NOTEBOOK_ID
Complete audio workflow:
#!/bin/bash
NOTEBOOK_ID="your-notebook-id"
# Remove old audio if exists
nlm audio-rm $NOTEBOOK_ID 2>/dev/null
# Generate new audio
echo "Generating audio overview..."
nlm audio-create $NOTEBOOK_ID "Create engaging 7-minute overview focusing on practical applications for business leaders"
# Wait for completion (check every 30 seconds)
echo "Waiting for audio generation..."
while true; do
STATUS=$(nlm audio-get $NOTEBOOK_ID | grep "Status")
if [[ $STATUS == *"ready"* ]]; then
break
fi
sleep 30
done
# Download and share
AUDIO_URL=$(nlm audio-get $NOTEBOOK_ID | grep -o 'https://.*\.mp3')
curl -o "research-overview.mp3" "$AUDIO_URL"
SHARE_LINK=$(nlm audio-share $NOTEBOOK_ID)
echo "Audio ready: $SHARE_LINK"
Complete content creation:
#!/bin/bash
NOTEBOOK_ID="your-notebook-id"
# Generate comprehensive guide
echo "Generating notebook guide..."
nlm generate-guide $NOTEBOOK_ID > guide.txt
# Create content outline
echo "Creating outline..."
nlm generate-outline $NOTEBOOK_ID > outline.txt
# Generate individual sections
echo "Generating sections..."
nlm generate-section $NOTEBOOK_ID > section1.txt
# Create summary note
NOTE_ID=$(nlm new-note $NOTEBOOK_ID "Generated Content Summary" | grep -oE '[a-f0-9-]{36}')
nlm edit-note $NOTEBOOK_ID $NOTE_ID "$(cat guide.txt outline.txt)"
echo "Content generation complete!"
Prepare notebook for team:
#!/bin/bash
# Create project notebook
NOTEBOOK_ID=$(nlm create "Team Research: Product Strategy" | grep -oE '[a-f0-9-]{36}')
# Add shared resources
nlm add $NOTEBOOK_ID "https://docs.google.com/shared-doc"
nlm add $NOTEBOOK_ID "https://company.com/market-report"
# Create team notes
nlm new-note $NOTEBOOK_ID "Meeting Notes"
nlm new-note $NOTEBOOK_ID "Action Items"
nlm new-note $NOTEBOOK_ID "Decisions"
# Generate initial materials
nlm generate-guide $NOTEBOOK_ID > team-guide.txt
nlm audio-create $NOTEBOOK_ID "Create onboarding overview for new team members"
# Get share link
AUDIO_SHARE=$(nlm audio-share $NOTEBOOK_ID)
echo "Share audio with team: $AUDIO_SHARE"
echo "Notebook ID for team: $NOTEBOOK_ID"
Naming conventions:
"PROJ-123: Market Analysis""2024-Q4: Competitive Research""[AI] [Ethics] Research Compilation"Source management:
Note structure:
Rate limiting:
# Add delays between commands
nlm add $NOTEBOOK_ID "url1"
sleep 2
nlm add $NOTEBOOK_ID "url2"
Batch operations:
Resource management:
Common issues:
Authentication errors:
# Re-authenticate
nlm auth
Rate limit errors:
# Add delays
sleep 5
Invalid notebook ID:
# Verify ID exists
nlm ls | grep <notebook-id>
Source processing failures:
# Check source status
nlm sources <notebook-id>
# Retry failed sources
nlm rm-source <notebook-id> <failed-source-id>
nlm add <notebook-id> <source-input>
Template for automation:
#!/bin/bash
set -e # Exit on error
# Configuration
NOTEBOOK_TITLE="Automated Research $(date +%Y-%m-%d)"
SOURCE_LIST="sources.txt"
# Error handling
trap 'echo "Error on line $LINENO"' ERR
# Create notebook
echo "Creating notebook..."
NOTEBOOK_ID=$(nlm create "$NOTEBOOK_TITLE" | grep -oE '[a-f0-9-]{36}')
# Validate notebook creation
if [ -z "$NOTEBOOK_ID" ]; then
echo "Failed to create notebook"
exit 1
fi
# Add sources with error handling
echo "Adding sources..."
while IFS= read -r source; do
if ! nlm add "$NOTEBOOK_ID" "$source"; then
echo "Warning: Failed to add source: $source"
fi
sleep 2
done < "$SOURCE_LIST"
# Generate content
echo "Generating content..."
nlm generate-guide "$NOTEBOOK_ID"
nlm audio-create "$NOTEBOOK_ID" "Create comprehensive overview"
echo "Complete! Notebook ID: $NOTEBOOK_ID"
"Authentication failed"
nlm auth to re-authenticate"Notebook not found"
nlm ls"Source processing failed"
"Rate limit exceeded"
"Audio generation timeout"
nlm audio-getEnable verbose output:
# Set debug environment variable
export NLM_DEBUG=true
# Run commands with debug info
nlm <command>
Check logs:
# Location varies by OS
# macOS/Linux: ~/.nlm/logs/
# Windows: %APPDATA%/nlm/logs/
tail -f ~/.nlm/logs/nlm.log
Get help:
nlm --help
nlm <command> --help
Bulk notebook creation:
#!/bin/bash
# Create multiple project notebooks
PROJECTS=("AI Ethics" "Market Analysis" "Technical Review")
for project in "${PROJECTS[@]}"; do
NOTEBOOK_ID=$(nlm create "Q4 2024: $project" | grep -oE '[a-f0-9-]{36}')
echo "$project: $NOTEBOOK_ID" >> notebooks.txt
# Initialize with template
nlm new-note "$NOTEBOOK_ID" "Project Overview"
nlm new-note "$NOTEBOOK_ID" "Resources"
nlm new-note "$NOTEBOOK_ID" "Tasks"
done
Periodic source refresh:
#!/bin/bash
# Refresh all web sources weekly
NOTEBOOK_ID="your-notebook-id"
# Get web sources (filter URLs)
nlm sources $NOTEBOOK_ID | grep "http" | awk '{print $1}' | while read source_id; do
echo "Refreshing: $source_id"
nlm refresh-source $source_id
sleep 5
done
Content export pipeline:
#!/bin/bash
# Export all notebook content
NOTEBOOK_ID="your-notebook-id"
OUTPUT_DIR="export-$(date +%Y%m%d)"
mkdir -p "$OUTPUT_DIR"
# Export guide
nlm generate-guide $NOTEBOOK_ID > "$OUTPUT_DIR/guide.md"
# Export outline
nlm generate-outline $NOTEBOOK_ID > "$OUTPUT_DIR/outline.md"
# Export all notes
nlm notes $NOTEBOOK_ID | while read note_id _; do
nlm edit-note $NOTEBOOK_ID $note_id > "$OUTPUT_DIR/note-$note_id.md" 2>/dev/null || true
done
# Download audio if available
nlm audio-get $NOTEBOOK_ID | grep -o 'https://.*\.mp3' | xargs -I {} curl -o "$OUTPUT_DIR/audio.mp3" {}
echo "Export complete: $OUTPUT_DIR"
# Setup
nlm auth
# Notebooks
nlm ls # List all
nlm create "title" # Create
nlm rm <id> # Delete
nlm analytics <id> # Stats
# Sources
nlm sources <id> # List
nlm add <id> <input> # Add
nlm rm-source <id> <source> # Remove
nlm rename-source <id> "name" # Rename
nlm refresh-source <source> # Refresh
nlm check-source <source> # Check
# Notes
nlm notes <id> # List
nlm new-note <id> "title" # Create
nlm edit-note <id> <note> "content" # Edit
nlm rm-note <note> # Remove
# Audio
nlm audio-create <id> "instructions" # Create
nlm audio-get <id> # Get
nlm audio-rm <id> # Delete
nlm audio-share <id> # Share
# Generation
nlm generate-guide <id> # Guide
nlm generate-outline <id> # Outline
nlm generate-section <id> # Section
# Batch
nlm batch <file> # Run commands
nlm auth before any operationsWhen user wants to use NotebookLM CLI:
nlm authRemember: NotebookLM CLI enables powerful research workflows through command-line automation. Combine with bash scripts and automation for maximum productivity.