↑ ↓ select, Enter open, Esc close

Run a local script on a remote server

Caution: This command changes the system. Understand what it does before you run it.

Adjust the values, the command updates live
user@server
ssh webuser@server.example.com 'bash -s' < ./check.sh

Passes the local script file as standard input to a Bash on the server, which executes it line by line. No file is left behind on the server. Arguments can be appended after bash -s, for example 'bash -s' -- arg1.

Note: The risk depends entirely on the script. Interactive commands do not work this way because standard input is already in use.

Also searched as

  • run local script on remote server ssh
  • ssh bash -s script
  • execute script remotely without copying

Related one-liners

All in SSH

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.