it2 window list
List all iTerm2 windows
Synopsis
it2 window list [flags]
Description
List all iTerm2 windows with detailed information and filtering options.
Examples
# List all windows (table format)
$ it2 window list
# JSON format for scripting
$ it2 window list --format json
# Show specific columns
$ it2 window list --columns id,name,bounds
# Sort by window ID (descending)
$ it2 window list --sort id --reverse
# Output only window IDs (quiet mode)
$ it2 window list -q
# Use with xargs to close all windows
$ it2 window list -q | xargs -n1 it2 window close
# Count total windows
$ it2 window list -q | wc -l
# Find window by name pattern
$ it2 window list --format json | jq '.[] | select(.name | contains("Production"))'
# Get first window ID for scripting
$ FIRST_WINDOW=$(it2 window list --format json | jq -r '.[0].id')
# Export window layout for backup
$ it2 window list --format json > windows-backup.json
# Close all windows except the first
$ for window_id in $(it2 window list --format json | jq -r '.[1:][].id'); do
$ it2 window close "$window_id"
$ done
# Focus on specific window by name
$ WINDOW_ID=$(it2 window list --format json | jq -r '.[] | select(.name=="Development") | .id')
$ it2 window focus "$WINDOW_ID"
Options
-
--columns - Comma-separated list of columns to display (e.g., 'window id,name,bounds')
-
-q,--quiet - Output only window IDs
-
--reverse - Reverse sort order (descending)
-
--sort - Column to sort by (e.g., 'Window ID', 'Name', 'Frame')
Options inherited from parent commands
-
--format(default "text") - Output format (text, json, yaml) - affects how command results are displayed
-
--timeout - Timeout for API operations - how long to wait for iTerm2 to respond
-
--url - WebSocket URL for iTerm2 API - typically ws://localhost:1912 for local iTerm2
See Also
- it2 window - Manage iTerm2 windows or navigate to window context
- it2 window clear-title - Clear the title of a window
- it2 window close - Close a window
- it2 window create - Create a new window
- it2 window current - Show the current window ID
- it2 window focus - Focus/activate a window
- it2 window get-property - Get a window property
- it2 window get-title - Get the title of a window
- it2 window set-property - Set a window property
- it2 window set-title - Set the title of a window
- it2 window tree - Show split tree structure for a window