This is a rather beginner question. Apologies for nothing more challening
I am running IPFS Desktop on my computer. I downloaded it via the Ubuntu Software Center. I believe it’s a snap install. I am using Ubuntu 20.04
I want to be able to access some of the CLI commands for the node that is being run via the IPFS Desktop but when I enter any ipfs command in the terminal, it says command not found. etc.
If I install the ipfs cli then it runs a different node through the terminal. Am I missing something obvious here? How can I access the IPFS Desktop node through the command line?
Idk about the snap, if your daemon is in a docker this might complicates things a bit (you would just need to forward the API).
But you can install the CLI from dist.ipfs.io aside of the desktop and call the desktop daemon perfectly fine (just match the version).
Your desktop IPFS build has the same binary files somewhere under his internal folders.
Quick solution: point the ipfs CLI client at the node run by IPFS Desktop by passing explicit API endpoint (ipfs --api=/ip4/127.0.0.1/tcp/5001). This will work even if your node runs in Docker or on a different machine in LAN.
Alternative is to set IPFS_PATH in your env to the directory used by IPFS Desktop. This is useful when your node runs on the same box and you need to run a command that does not work over API and requires direct access the repository (like ipfs key export|rotate).
Note that in Mac running IPFS Desktop will also run IPFS daemon which is accessible via command line. So it all has to do with your installation I think.
Thank you all for your answers. I believe the problem was in installing it using snap store (Ubuntu Software Center) because this changes the default path of the installations. So in effect, the desktop and cli were installed at separate paths.
I followed the installation on the IPFS site which uses the install script and that put it in the correct path.
So I re-installed only the CLI and use the webUI in place of the desktop. Along with IPFS Companion, desktop is not really needed.
But I still wanted the functionality of having the desktop run the daemon behind the scenes without having a terminal open, so I created the following service unit file to do that:
Paste the following code in the file /etc/systemd/system/ipfs.service
Longer: this is for smooth updates when there is a new version of go-ipfs binary.
IPFS Desktop is a GUI that talks to the (go-ipfs) daemon.
When you let Desktop app run and orchestrate IPFS node, it will run ipfs daemon for you, and it will pass --migrate=true to ensure your datastore is migrated each time Desktop app ships with updated daemon.
The setup you described is bit different, you run daemon on your own manually via systemd script. If there is an update of go-ipfs binary, the script will refuse to start and display an error informing you about required datastore migration. By passing --migrate=true you ask it to automatically apply any necessary migrations, so you don’t need to worry about running them manually .