tabs - macOS


Overview

tabs is a versatile macOS command-line tool for managing terminal tabs within a single window.

Syntax

tabs [options] [tab-command]

Options/Flags

  • -a | –add: Create and open a new tab.
  • -c | –close: Close the current tab.
  • -j | –join: Join the current tab to the previous tab.
  • -k | –kill: Kill all tabs except the current one.
  • -l | –list: List all open tabs.
  • -m | –move: Move the current tab to a specified index.
  • -n | –new: Open a new tab with the specified path.
  • -o | –open: Open the specified file or directory in the current tab.
  • -p | –previous: Move to the previous tab.
  • -r | –reload: Reload the current tab.
  • -s | –save: Save the current window layout.
  • -t | –title: Set the title of the current tab.
  • -w | –window: Create or switch to the specified window.

Examples

Create a new tab:

tabs -a

Open a file or directory in the current tab:

tabs -o ~/Documents/MyProject

Move the current tab to the first index:

tabs -m 1

Close all tabs except the current one:

tabs -k

Common Issues

Missing file or directory: If the path specified with the -o option doesn’t exist, you will get an error. Ensure that the file or directory is accessible.

Cannot move to non-existent index: If you try to move a tab to an index that doesn’t exist, you will get an error. Use the -l option to verify available indices.

Integration

Use with other commands:

find . -print0 | xargs -0 tabs -a

Create a script for specific tab management:

#!/bin/bash

tabs -a
tabs -o ~/Downloads/myfile.txt
tabs -m 2
  • screen: Terminal multiplexer with tabbed windows.
  • iTerm2: Terminal emulator with advanced tabbing capabilities.
  • tmux: Terminal multiplexer with support for sessions and multiple windows.