Updated: 28 September 2026 · Applies to: AlmaLinux 9, Rocky Linux 9, Ubuntu 24.04 and Debian 12

Bash aliases are defined for interactive shells, so ssh server myalias fails: the remote command runs in a non-interactive shell that does not load them.

Options

  • Run an interactive shell for the command: ssh -t server 'bash -ic myalias'.
  • Better: turn the alias into a small script in ~/bin/ (make it executable and add ~/bin to PATH), which works in any shell.
  • Or define a function in ~/.bashrc and call ssh server 'bash -ic myfunction'.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket