The terminal is your tool for controlling your Mac using text commands. Forget clicking menus – here, you type! This guide focuses on iTerm2, a powerful and customizable alternative to the basic Mac Terminal.app. Inside iTerm2, your shell (configured as Zsh) helps you run commands efficiently.
iTerm2 makes working in the terminal easier and more productive with features like:
- Tabs: Open multiple terminal sessions in one window (
Cmd + Tfor a new tab). - Panes: Split a single tab into multiple sections to run commands side-by-side (
Cmd + Dfor vertical split,Cmd + Shift + Dfor horizontal split). - Custom Looks: Change colors, fonts, and transparency to suit your style (
Cmd + ,to open settings). - Search: Quickly find text in your terminal output (
Cmd + F). - Profiles: Save different settings for different tasks.
You can launch iTerm2 just like any other app:
- Spotlight Search: Press
Cmd + Space, typeiTerm, and press Enter. - Applications Folder: Open
/Applicationsand double-clickiTerm.
Here’s what you’ll see when you open iTerm2:
- The Prompt: This is where you type commands. It usually ends with
$. Your Powerlevel10k prompt shows helpful info like your current folder and Git status:(In this example, the user╭─ ravi@Raviss-MacBook-Pro ~/Projects/dotFile (main ✔) ╰─ $ _raviis in the folder~/Projects/dotFile, on the Git branchmainwith no changes (✔), ready to type a command ($).) - Cursor: The blinking underscore
_or block shows where your typing will appear. - Tabs: Like browser tabs, they let you open multiple terminal sessions (
Cmd + Tfor new,Cmd + Wto close). - Panes: Split your terminal into sections to multitask:
Cmd + D: Split the current pane vertically.Cmd + Shift + D: Split the current pane horizontally.Cmd + ]orCmd + [: Switch between panes.Cmd + W: Close the current pane.
Here are some essential commands and shortcuts to get started:
- Execute: Type a command (e.g.,
ls -lhaorpwd) and press Enter. - Stop a Command: If a command is stuck, press
Ctrl + Cto interrupt it.
-
Tab Completion: Start typing a command, file, or folder name, then press
Tab:- If there’s one match, it completes automatically.
- If there are multiple matches, it shows a list. Press
Tabagain to cycle through them. - Example: Type
cd Projand pressTab. It might complete tocd Projects/.
-
Command History:
- Use the Up Arrow to see previous commands.
- Use the Down Arrow to move forward in history.
- Press
Ctrl + R, then type part of an old command to search your history. Press Enter to run it orCtrl + Cto cancel.
Ctrl + L: Clears the visible terminal screen (scroll up to see previous output).Cmd + K: Clears the entire scrollback buffer (everything above is gone).clear: Typing this and pressing Enter does the same asCtrl + L.
- Copy: Select text with your mouse. In iTerm2, selecting text usually copies it automatically (check settings). Otherwise, use
Cmd + C. - Paste: Press
Cmd + V.
The terminal is a powerful tool once you get the hang of it. Start with these basics, and don’t be afraid to experiment (safely). For more commands, check out the "Basic Terminal Commands" guide.