Execute command in SSH without opening shell

Generally whenever we intend to run some command on remote machine, we first do a ssh and then type the command to be executed.

Here is a very small "trick" to be more smarter.

Lets say you want to run "top" command on the machine x.x.x.x using SSH.

First find out the path of the top command using -

whereis top

Once you get the path. Now just type this -
ssh user@x.x.x.x /path/to/the/command

No comments:

Post a Comment