OctoPrint commands in terminal


Hello I'm new in this forum and very pleased wit this amazing tool called OctoPrint.
I've got in installed on Raspberry 3B and I'm been using it with WiFi on my computer and also trough ssh.

My question is concerning everything you can achieve usin ssh and the terminal, for instance controlling temperature or checking the printers status, etc...

Thanks for your help


Almost everyday that I am using my OctoPrint, I refer to this page which includes all the GCODE commands. It would be good to read a little of that to understand how simple these toolpath commands are at the heart of what's going on.

In your OctoPrint -> Terminal tab, you could toggle off the display for things like temperature so that it's not so busy. Then enter M115 and read the response. The page suggested above describes that as "M115: Get Firmware Version and Capabilities". So if anyone asks you about your firmware version, that's the fastest way to get the response.

Lookup M190 and M104 and understand the difference. One will set the hotend temperature (in Celsius) and the other will do the same thing, only it will wait until it gets there. We call that "blocking" meaning that it won't accept anything else to do until it completes that task.

Find a small gcode file and open it up on your workstation in a text editor. Read the top 30 lines and lookup those commands. It's important to understand what absolute and relative modes mean. Absolute means that I could tell the assembly to move to a certain X/Y position. Relative means that I could tell the assembly to move over a certain amount from where it was a moment ago.

Read this troubleshooting guide for some how-to's with respect to a Raspberry Pi, remoting in and such. Look for "Remote in with SSH", for example.

I buy books. I have the O'Reilly "Raspberry Pi Cookbook" and "Bash Pocket Reference", Wiley's "Learning Python with Raspberry Pi".

There are the OctoPrint docs as well.


Thanks a lot for all that information.
My question was, if it was possible through the Linux terminal on my computer,
to control several situations like temperature of bed or extruder,
using the command line in the terminal.

P.S I think I'll puchase tho O'Reill "Raspberry Pi Cookbook"


One of the suggestions was to see how to remote into the Raspberry with SSH. Once there in a remote terminal session on the Pi, it's not easy to query the temperature of the bed or extruder, though. You can do many things with the GPIO pins for adding things on but not that.

The best way to try to talk to OctoPrint—from either a remote or local terminal session—is to use curl.

curl -H "X-Api-Key: THIS-IS-YOUR-API-KEY-FROM-SETTINGS-API-AREA" -X GET http://octopi.local:5000/api/printer

Then look for the information you want, like...

  "temperature": {
    "tool0": {
      "actual": 214.8821,
      "target": 220.0,
      "offset": 0

This could be turned into a shell script by using awk to find the temperature value you were interested in.

If you knew Node, then my new octo-client might be an easier way of doing this.


Thans a lot I'll try this asap


It's a bit of work if you don't already have node and npm loaded, but I just created a command line interface with octo-client.

  1. mkdir -p ~/sites/octo-temps && cd ~/sites/octo-temps
  2. npm init
  3. touch index.js
  4. npm install --save octo-client
  5. nano index.js
#!/usr/bin/env node

var OctoPrint = require('octo-client');

  if (response) {
    if (response.temperature) {
      if (response.temperature.tool0) {
        var t = response.temperature.tool0;
        console.log('The first hotend is set to ' +
          t.target.toString() +
          'C and is currently ' +
          t.actual.toString() + 'C.')
  1. nano node_modules/octo-client/config.js
    # Edit with your API key from OctoPrint -> Settings -> API

  2. chmod a+x index.js

  3. sudo ln -s /Users/me/sites/octo-temp/index.js /usr/local/bin/octo-temps

  4. # Verify that the printer octopi is turned on and connected

  5. octo-temps

The first hotend is set to 0C and is currently 26.3C.


Stupid question but why are you installing a remote web GUI like octoprint, if your goal is to be able to control it through a terminal? Why not just use something like pronterface's command line utility, aptly named "pronsole"?

Or do you actually use the web gui, and just want more control options through a terminal for perhaps a low bandwidth connection?


Thanks for you thread. Well is started with Pronterface which is great because in includes everything.
I had installed it on my Ubuntu-Mate machine and it worked fine. But the i tried to install it on other Debian machines and I didn't manage to install it, due to some weird Python problem.

I tested Octopi on a Raspberry 3B where everything goes trough WiFi an in thought it was easy to install and very performing.

My question about the terminal was simple curiosity because I like to try tio make little scripts on the terminal...

But its true Pronterface is Ă  very good software