Default Shell
1. What the default shell is 2.3.3
Every account on a server has a login shell, the shell SSH starts when you sign in. Often it is bash, while the shell you actually like on that host is zsh or fish. The default shell is a per-host setting in meshTerm: meshTerm connects with your login shell as usual, then starts the shell you chose. Every new session on that host starts in it.
- Nothing on the server changes. meshTerm doesn't run
chsh, doesn't edit/etc/passwd, and on Windows doesn't change OpenSSH'sDefaultShell. Other SSH clients, scripts andscpkeep using the login shell. Choose Login shell again and meshTerm goes back to starting nothing extra. - Only shells found on the host are offered. On Linux and macOS, meshTerm reads
/etc/shellsand looks on your PATH for bash, zsh, fish, ksh, mksh, dash, tcsh, csh and nu. If a shell is installed twice (for example/bin/zshand Homebrew's/opt/homebrew/bin/zsh), both are listed with their paths. On Windows the choices are Command Prompt, Windows PowerShell and PowerShell 7, when installed. - Checking a host's shells is one read-only command over the connection you already have. It installs nothing.
- The login shell is always at the top of the list, marked Login shell (SSH default shell on Windows).
- You can also switch one session to another shell from the palette, without changing the host's default.
2. Choosing on first connect
The first time you connect to a new host, meshTerm checks which shells it has. Your session starts in the login shell straight away, so you can type while it checks.
- The keyboard palette opens on the Default Shell for your host list, showing "Checking shells…" and then the shells it found. Close works at any time, including while it is still checking.
- Pick a shell and it becomes the host's default shell, and this session moves to it too (see below). Picking Login shell keeps things as they are.
- Close (or the palette button while the list is up) keeps the login shell.
- Either way the keyboard comes back, and meshTerm doesn't ask about that host again, on this device or, with iCloud Sync on, on your other devices.
- If the host only has its login shell, you see "Only bash found" (or the shell's name) for a moment, and nothing is asked.
- Until you answer, the palette's Shell tile opens this same list.
When the default changes from this list:
- If you haven't typed anything yet in the session, meshTerm switches right away: you see "Switching to zsh" and the session restarts in the new shell.
- Otherwise nothing you are running is interrupted. A notice says "Default shell: zsh" and "Applies from your next connect." Tap Reconnect Now to switch now.
The list waits until it can be seen properly:
- iPhone in landscape: the palette is portrait-only, so the list waits until you turn the phone to portrait. If you rotate to landscape while it is up, it goes away and comes back in portrait.
- Another screen open (for example Files): the list waits until you close it.
- Hardware keyboard (such as an iPad with a keyboard attached): a banner shows "Checking shells…", then "Other shells found on" your host with Choose, which opens the same list. The banner's close button keeps the login shell.
The first-connect list is only shown for ordinary terminal sessions on a host you haven't connected to before, and not on hosts that use mtRoam (see below).
3. Changing the default
To change a host's default shell later, go to Edit Host > Shell & Environment and, under Shell, tap Default Shell. The row shows the current choice, or Login shell.
- The current choice is ticked, and a pick is saved at once. Every new session on the host starts in it.
- Detect Again checks the host's shells again, for example after you install fish.
- A shell you chose earlier that the host no longer has stays in the list, marked "Not found on this host".
- For a host you have never connected to, the list says "Connect to this host once to see its shells."
- To go back to the login shell, pick Login shell.
The palette's Shell tile doesn't change the default. It switches only the session you are in (next section).
4. Switching one session 2.3.3
On the keyboard palette's Features page, tap Shell. The list shows the shells found on the host, with Detect Again. What a pick does depends on the session:
Sessions without tmux or psmux
- The list is headed Shell for This Session. Pick a shell and the tab reconnects in it.
- If you've typed in the session, meshTerm asks first: "Reconnect in fish?", because the current shell and anything running in it will end. Tap Reconnect, or Cancel to keep things as they are.
- The tab keeps that shell until you close it: through reconnects, resuming from Sessions, and after the app restarts. On Sessions, each of these tabs shows its shell and when it was opened, for example "fish, opened 2:32 PM".
- New tabs, and new sessions on the host, use the default shell.
tmux and psmux sessions
- The list is headed Open a Window In. Pick a shell and meshTerm opens a new window running it, and the window becomes the active one. A short note says "Opened a fish window".
- Other devices and clients attached to the same session see the new window too.
- Other new windows and splits, including ones you open with the tmux prefix keys, use the host's default shell. To get another window in the shell you picked, pick it again.
- If the window can't be opened, a notice says "Couldn't open a fish window".
The tick, "Running now" and "Host default"
- The host's default shell is labelled Host default in the list (the login shell, when the host has no default). Pick it to put a tab back on the default.
- Without tmux or psmux, the tick marks the shell the tab starts in. If you've started another shell inside it (for example you typed
bash), the list also shows "Running now: bash". Picking that shell makes it the one the tab starts in. Picking the ticked shell does nothing. - With tmux or psmux, the tick marks the shell running in the active pane. When that pane is running something else, such as an editor or an agent, nothing is ticked.
5. When the Shell tile is dimmed
Some sessions can't switch shells. Their Shell tile is dimmed, and tapping it shows the reason for a moment instead of the list:
| Session | What it says |
|---|---|
| Agent, container, one-tap and herdr sessions, and others that run a command | "This session runs a command, so its shell can't be switched." |
| mtRoam sessions | "mtRoam sessions use the login shell." |
| A tmux or psmux host where tmux or psmux couldn't start this time, so the session runs without it | "Reconnect first: this session couldn't start tmux." (or psmux) |
| A first connect where meshTerm couldn't yet tell what kind of host it is | "Reconnect first to switch shells." |
| A session that isn't connected | "Connect first." |
For the "Reconnect first" cases, reconnect the session and the tile works again.
6. tmux, psmux, Windows and mtRoam
How the default shell is used depends on the host's Persistence choice. The Default Shell list's footer says which rule applies to the host.
| Host | Default shell | Shell tile |
|---|---|---|
| Linux or macOS, Persistence None | Each new connect starts in it. | Reconnects the tab in the shell you pick. |
| Linux or macOS, tmux | tmux starts new sessions and new windows in it. A tmux session that's already running keeps its shells. | Opens a new window in the shell you pick. |
| Windows with psmux | The same as tmux: new psmux sessions and new windows start in it; a running session keeps its shells. | Opens a new window in the shell you pick. |
| Windows without persistence | Each new connect starts in it. | Reconnects the tab in the shell you pick. |
| mtRoam | mtRoam sessions use the login shell, for now. The choice is kept, and applies if the host switches to tmux or no persistence. Edit Host says so under Shell. | Dimmed. |
Windows and panes you create inside tmux or psmux yourself also start in the default shell. When you go back to the login shell as the default, meshTerm removes its setting from the tmux session on your next connect, and leaves alone any tmux setting you made yourself.
7. Sessions that use the login shell
Agent, container and one-tap sessions always use the login shell, whatever the host's default shell. That covers Agent Mode and agent sign-in, a container's Shell, Run in Terminal and other one-tap commands, and herdr sessions. These run commands meshTerm has tested against the login shell, so they stay predictable, and their Shell tile is dimmed.
8. If a shell is missing
meshTerm checks that a shell still exists every time it starts it. If it has been removed, or can't start, you still get a working session, and a notice.
- A shell you picked for one session: "fish isn't available on" your host, with "This tab started in the login shell instead." The tab drops that pick and goes back to the host's default shell. With tmux or psmux, the new window starts in another shell, or you see "Couldn't open a fish window".
- The host's default shell: "fish isn't available on" your host, with "This session started in the login shell instead." (with tmux or psmux: "The new session or window started in the default shell instead."). Tap Change Shell in the notice to open the Default Shell list for the host and pick another shell, or Login shell. This changes the host's default.
- On psmux, a shell with a very long path can't be started by psmux: the notice says the shell "couldn't be used" and the session started in the default shell.
9. Environment and Secret Profiles
Variables from Shell & Environment and Secret Profiles reach the shell when a session starts, whichever shell you chose. A window opened from the Shell tile gets them like any other window in the session.
Sending values into a session that is already running works only in bash and zsh. In another shell (fish, tcsh, nu and so on, or a Windows shell), Secret Profiles says the session's shell can't receive values while it's running; the values still apply when a session starts. To switch, use Shell in the terminal palette.
10. Good to know
- Login messages: on a host without persistence, a session that starts a shell other than the login shell doesn't show the server's message of the day (MOTD) or the "Last login" line.
- Keep Tools on PATH: when the default shell is bash or zsh, the block is added to that shell's
~/.bashrcor~/.zshrctoo, alongside the login shell's. The same happens when you switch a session to bash or zsh. - Syncing: with iCloud Sync on, the host's default shell and the fact that you've answered the first-connect question sync with the host. A shell picked for one session stays on that device. Each device checks the host's shells itself.
- Hosts meshTerm can't check: if checking a host's shells can't work there (for example, PowerShell is restricted by policy), meshTerm stops asking on first connect. You can try Detect Again from Edit Host or the Shell tile later.
- Windows hosts whose SSH shell is MSYS2, MinGW or Cygwin aren't asked.
For hosts, persistence and the palette, see the User Guide.