Skip to content

Terminal and shell

The terminal panel sits below the file panes and can hold several tabs. Each tab keeps its process and scrollback while another tab is active.

ActionShortcut
Show or hide the panelCtrl + `
Create a terminalCtrl + Shift + ~
Type the selected names into the terminalMod + Enter
Previous or next terminalCtrl + Page Up / Ctrl + Page Down
Focus the panes or terminalAlt + Up / Alt + Down
Maximize the focused terminal or restore the splitMod + F11

A new terminal starts in the active pane’s directory; from inside an archive it starts beside the archive. For S3, SFTP, and other mounts with no shell directory, it starts in the session’s default directory. In a remote or elevated session, the shell runs on that target, not on the computer displaying Newt.

Open in Terminal (Mod + Enter) types the selected names, or the focused one, into the active terminal, quoted for Bash, and moves focus there so you can finish the command. If no terminal is open, it opens one first.

While a terminal has focus, keys go to the program running there, even when a Newt command uses the same key; shortcuts such as Ctrl + R or F10 mean something to a shell. The exceptions are the panel commands in the table above (except Open in Terminal) and any binding with when = "terminal_focused".

The maximize button at the right end of the tab bar lets the terminal fill the window; see Maximized layout. While it is maximized, Alt + Up shows the active pane.

Right-click inside a terminal for Copy, Paste, Select All, Clear (clears the scrollback but keeps the prompt), Close Terminal, New Terminal, and maximize and hide commands. Right-clicking a tab also offers Close Other Terminals.

When the program in the terminal uses the mouse, such as tmux, htop, or vim with mouse=a, a right-click goes to the program. Hold Shift while right-clicking to open Newt’s menu, or while dragging to select text.

Copy and paste with Ctrl + Shift + C/V on Linux and Windows, the standard Command shortcuts on macOS, or the context menu. Ctrl + V is sent to the program as ^V. Newt does not ask for confirmation before pasting several lines.

When behavior.keep_terminal_open is enabled, an exited shell stays visible until you press Enter in that tab.

Under Terminal in Settings, choose the font as a CSS font-family list (the first installed font is used), the font size in pixels, and the number of scrollback lines per terminal (1000 by default). Changes apply to open terminals immediately. The defaults depend on the platform:

PlatformDefault fontDefault size
macOSMenlo, Monaco, "Courier New", monospace12
Linux"Adwaita Mono", "Source Code Pro", Hack, "DejaVu Sans Mono", monospace13
Windows"Cascadia Mono", Consolas, "Courier New", monospace12

Built-in terminals and user commands have a newt command on their path that controls the visible panes from scripts:

Terminal window
newt pwd
newt ls -lh
newt cd ~/projects
newt focus Cargo.toml
newt view README.md
newt edit src/main.rs
newt cat archive.zip/README.txt
newt cp report.pdf ../archive/
newt mkdir -p build/reports
newt select '*.rs' --add
newt cmd copy
  • Most commands accept --pane active, other, left, or right. Paths can use mounted forms such as s3://bucket/key, and separators follow the target pane’s filesystem. cat, view, and edit resolve relative paths against the pane, so they work inside archives and S3; the other commands resolve them against the shell’s directory.
  • newt ls prints the pane’s entries as the pane lists them, in its order and with its filter and hidden-file setting, so it also works in archives and S3. -s prints only the selection (or the focused entry), -a every entry, -l a long format like ls -l (-h for K, M, and G sizes), -p paths instead of names, -0 NUL separators, and --json a JSON array. For example, newt ls -sp0 | xargs -0 du -sh hands the selection to another tool.
  • newt select uses the same glob or /regex syntax as Select by Pattern. It replaces the selection unless you pass --add or --remove. With no pattern it reads names from standard input, so git ls-files | newt select selects those files in the pane.
  • newt cp, newt mv, and newt rm run as Newt operations and return at once. With --wait they return when the operation ends, with status 1 if it failed or was cancelled; Ctrl + C while waiting cancels the operation.
  • newt rm deletes without asking; directories need -r. Like Delete, it uses the trash when Delete to Trash is on, and then deletes nothing on a filesystem without a trash (S3, SFTP, archives) unless you pass --permanent.
  • newt mkdir creates directories on whatever filesystem the path names, including S3 and SFTP mounts; -p creates missing parents.
  • newt edit --wait returns once the editor window closes, so EDITOR='newt edit --wait' lets git commit, crontab -e, and similar tools use Newt’s editor.
  • newt cmd <id> runs any Command Palette command by its keybinding ID (user_command_N for user commands, which can also be named by their title, such as newt cmd 'Open in Vim'), exiting with status 1 on failure. Run newt cmd alone to list the IDs.

Run newt --help or newt <command> --help for full syntax and examples.

newt completions prints a completion script for bash, zsh, fish, elvish, or powershell. Because newt is this command only inside Newt’s terminals, load it conditionally from your shell’s startup file:

Terminal window
[ -n "$NEWT_SHELL_SOCK" ] && source <(newt completions bash)

Shell integration is controlled by behavior.shell_integration for local sessions and is always available inside remote agent sessions. In a remote session, newt cmd can reach your computer’s clipboard and applications, so it works only when the session has access to this host; the other commands always work.