After ipfs add <file> I don't see it in ipfs files ls

After issuing ipfs add <file> I can see that it’s being added:

ipfs add -w ~/Downloads/go-ipfs_v0.4.22_linux-amd64.tar.gz
added QmcB55KNpU1E8uvqFtFa9QTFWPTHnfSmC1N7Hg6c5qYYX9 go-ipfs_v0.4.22_linux-amd64.tar.gz
added QmUdpSaoczmMJk7KPXrrn22dGH8C2GSXjUWrqAywwVcAHU
 19.93 MiB / 19.93 MiB [===========================================================] 100.00%

but afterwards I cannot see it in either the webui or ipfs files ls

Why is that?

@pmalek ipfs files is the interface for MFS (Mutable File System). This is like having a unix filesystem view of IPFS content.

However, ipfs add does not put the content you add on MFS. In order to see it there you need to do something like ipfs files cp <Qmhash> / (if my memory is correct).

That’s correct. You can also just use ipfs files write with a path and pipe the content into it, to write it directly as a file.

Ok, so this worked.

ipfs files cp /ipfs/QmcB55KNpU1E8uvqFtFa9QTFWPTHnfSmC1N7Hg6c5qYYX9 /
ipfs files ls
QmcB55KNpU1E8uvqFtFa9QTFWPTHnfSmC1N7Hg6c5qYYX9

but is there a way to list all the files add via ipfs add?

Unless you manually set --pin=false, they will be pinned, so you can do ipfs pin ls --type=recursive.

Yeah sure, you get the full list of added files as output after running ipfs add.

The question is: What do you want to achieve? :thinking:

I’m trying to figure out how this all works and this bit got me confused. Thanks in general. I’ll keep exploring and maybe reading some docs.

There’s basically two different types of ways to add data:

With ‘add’, then they just got pinned (by default).

And if you use ‘files write’ a mutable data structure will be added, which can be manipulated with other ‘files’ commands.

When you use ‘files cp’ to a previously added CID, you add the mutable data structure to it, and a corresponding file name in it.

Note that ‘mutable’ means, that changes can be done easily, and not that the CID won’t change, when you edit it.

If you link a CID of any kind or someone pins a CID, the data are guaranteed to never change.

So when you do an update on a file and want someone else to notice the change, you need an ipns entry. These ipns ids which can be updated to point to new CIDs.

The ipns entries are cryptographically signed by a private key, to avoid changes by peers which are not allowed to change them.

To make ipns entries human readable you can use regular DNS names, and add custom text fields - that’s called DNSLink.

Keep in mind that you currently cannot pin neither DNSLink entries nor ipns ids. So other people cannot ‘subscribe’ to changes you make.

To allow peers to subscribe to changes, you need to create an ipfs cluster, which can have follower peers which pull all changes you make on the ‘trusted nodes’ (nodes which can write to the cluster) in the cluster.

Hope this clears up a bit the current situation.

If you see any way to improve the documentation, feel free to create a pull request!

Best regards

Ruben

1 Like

I’m really confused by all this. I have ipfs running on 2 (almost identical) machines. On one machine I can do
ipfs add <myfile.txt>
followed by ipfs files ls
And this command prints <myfile.txt>. This is in fact correct according to some tutorials I followed. But on the second machine, “ipfs files ls” gave no output, nor did the file appear on the webUI.

So I upgraded ipfs on the 2nd machine from 0.9 to 0.12 and still got the same results.

I can confirm that the add command does actually work because I can retrieve the file contents using the hash. So the data is there, but no filename attached to it. However, I always had a filename on the 1st machine.

How can I ensure that the data I add has a filename attached to it?

By the way the entire documentation is put inside the ipfs command line tool, just ipfs --help