A useful feature of Dataplicity's Porthole is its Command Line Interface.
A Command Line Interface (CLI) provides all the functionality that a user has when using the graphical interface of Porthole. The biggest benefit of a CLI however, is that a user can automate many operations that would have to be done by hand otherwise. The ability to run porthole from terminal is also useful when a user connects via SSH to his Windows PC. Others might simply prefer the terminal window experience rather than using graphical interface.
All available commands that Porthole supports can be seen when you simply type
porthole into the command prompt.
To open Windows Command Prompt type in "cmd" into the search bar near the start menu.
Then in terminal window run:
In response you will get all available commands with a description and how to use them:
Displays info about current user.
Lists all available devices.
Lists all assigned forwards.
porthole account:login [login] [password]
To log in with provided credentials.
porthole account:setkey [auth token]
To re-use existing user session.
To log out.
porthole devices:status [device ID]
To check the online status of specified device. Device ID is optional, if not provided the list of device statuses will be displayed.
porthole devices:reboot [device ID]
To reboot specified device.
porthole devices:command [device ID] [command]
To issue a command for specified device.
porthole devices:terminal [device ID]
To start a terminal session with specified device.
porthole forwards:add [local port] [device ID] [remote port]
To add a forward where local port is this machine port and remote port is a port of external device to forward local port to.
porthole forwards:delete [local port]
To remove forward assigned to specified local port.
Let's take a couple of the above commands to see how you can interact with Porthole.
Firstly let's have a look at the account that you're logged in with:
Signed in as User ([email protected])
Now let's see the list of forwarded devices, this is the same one you see in the graphical interface:
Let's issue an
ls command directly to the first device on the list:
porthole devices:command 11111111-1111-1111-1111-111111111111 ls
bin dev home lib man mnt proc run srv tmp var
boot etc lost+found media opt root sbin sys usr
Pretty cool but let's have a look at running something like
porthole devices:command 11111111-1111-1111-1111-111111111111 htop
Now the biggest advantage of the CLI. Let's check the contents of
/home/pi directories on two separate devices. This involves porthole command combined with some Windows batch scripting.
for %x in ( 11111111-1111-1111-1111-111111111111 22222222-2222-2222-2222-222222222222 ) do ( porthole devices:command %x ls /home/pi )
Updated over 2 years ago