How can i get hash if i forget

when i add file to ipfs and will get the hash
but if i lose the hash how can get it again

1 Like

Hello, you can see all your local files if you navigate to the webui. It’s located at:
http://127.0.0.1:5001/webui. On the page press the files tab, you will then see a list of all local files. Hope it helps!

1 Like

You can also list your local blocks with ipfs refs local. However, if you added the file yourself, it was likely automatically pinned so you can find it in your ipfs pin ls list.

To view only the files that you uploaded:

ipfs pin ls | egrep recursive

To count the number of pinned files you are hosting:

ipfs pin ls | egrep recursive | wc -l

The solution by @stebalien is correct as well, in addition to the recursive files it will list the hash of indirect files as well.

Incase you were going to look that up:

direct = pin that specific object.
recursive = pin that specific object, and indirectly pin all its decendants
indirect = pinned indirectly by an ancestor (like a refcount)

1 Like

Note that if you just want to print out the recursive pins you should just use

ipfs pin ls -t recursive

It’s going to be way faster than getting all pins and then grepping the recursive ones (especially if you have a lot of large pins).

1 Like