![]() ![]() The equally common situation, when there is some Bash script on a Linux machine and it needs to connect from it over SSH to another Linux machine and run this script there. ![]() Show the kernel version, number of CPUs and the total RAM: $ ssh << EOFĮOF SSH: Run Bash Script on Remote Server Get the memory usage and the load average: $ ssh 'free -m | cat /proc/loadavg' Get the uptime and the disk usage: $ ssh 'uptime df -h' – or – $ ssh 'COMMAND1 | COMMAND2 | COMMAND3'Ĭool Tip: SSH login is too slow? This can be fixed easily! Get rid of delay during authentication! Read more → Examples Run multiple command on a remote host over SSH: $ ssh 'COMMAND1 COMMAND2 COMMAND3' ![]() There are a lot of different ways of how it can be done, but i will show the most popular of them. Much more often it is required to send multiple commands on a remote server, for example, to collect some data for inventory and get back the result. In the most cases it is not enough to send only one remote command over SSH. Reboot the remote server: $ ssh 'reboot' SSH: Run Multiple Remote Commands Get the uptime of the remote server: $ ssh 'uptime' This information will be especially useful for ones, who want to create a Bash script that will be hosted locally on a one Linux machine but would be executed remotely on the other hosts over SSH.Ĭool Tip: Connect to a remote SSH server without typing a password! Configure a passwordless authentication! Only 3 easy steps! Read more → SSH: Execute Remote CommandĮxecute a remote command on a host over SSH: $ ssh 'COMMAND' Examples In this article you will find the examples of how to execute a remote command, multiple commands or a Bash script over SSH between remote Linux hosts and get back the output (result). This is quite a common task for Linux system administrators, when it is needed to execute some command or a local Bash script from a one Linux workstation or a server on another remote Linux machine over SSH. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |