create account

[IPFS Tutorial #3] - Using the IPFS Command Line Interface by hsynterkr

View this thread on: hive.blogpeakd.comecency.com
· @hsynterkr · (edited)
$1.01
[IPFS Tutorial #3] - Using the IPFS Command Line Interface
![ipfs](https://ipfs.io/ipfs/QmTgtbb4LckHaXh1YhpNcBu48cFY8zgT1Lh49q7q7ksf3M/raster-generated/ipfs-logo-text-512-ice.png)
><center>[source](https://ipfs.io/ipfs/QmTgtbb4LckHaXh1YhpNcBu48cFY8zgT1Lh49q7q7ksf3M)</center>

#### What Will I Learn?

- How to Initialize and configure a local IPFS node
- Upload files to your local IPFS node with CLI
- Track files from your local IPFS node with CLI

#### Requirements

- Laptop or Desktop Computer (Windows, Linux or Mac)
- [IPFS CLI](https://ipfs.io/docs/install/)
- Several different files to upload (gif, mp4, .png etc.)

#### Difficulty

- Intermediate


#### Initialize a Local IPFS Node
Initializing the IPFS daemon is very simple, just [download](https://ipfs.io/docs/install/) the compatible version of your computer and install it.

After installation is complete, start the daemon with the command line.
````
ipfs init
````

![image.png](https://cdn.utopian.io/posts/73c6502190a45a5dc0d8e3e9c237ba88a892image.png)

Enter the **ipfs init** command to start the daemon. This will create a local IPFS node on your machine.
After ipfs is initialized, it will create a readme file. Enter the following command to view the readme file.

````
ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme
./readme
````

![image.png](https://cdn.utopian.io/posts/73b5a46b7318dc54c44d9be8175c93efb5eaimage.png)

You can explore other files(about, help, quick-start, security-notes) in there.

#### Configure the IPFS Node
The daemon configuration file is kept as a json file. Run the following command to view this configuration. 
````
ipfs config show
````
To edit the configuration, run the following command. for example, you can change ports for API or Gateway.
````
"API": "/ip4/127.0.0.1/tcp/5001",
"Gateway": "/ip4/127.0.0.1/tcp/8080" 
````
If you want to allow or deny HTTP POST requests, you can also set this with the config file.
````
"HTTPHeaders": {
       "Access-Control-Allow-Headers": [
         "X-Requested-With"
         "Range"
       ]
       "Access-Control-Allow-Methods": [
         "GET,POST"
       ]
       "Access-Control-Allow-Origin": [
         "*"
       ]
     }
````
#### Upload files to your local IPFS node with CLI
To upload a file to IPFS, run the IPFS daemon with the following command.
````
ipfs daemon
````
![image.png](https://cdn.utopian.io/posts/e7159910ea6b9cdb20b6fafdc94b1e9cfe13image.png)
You can create a folder  on the desktop for the files you want to upload. I created a folder named 'examples'
I have added a few files to the examples folder to upload them to the IPFS node 

To upload a file to the IPFS node,  open a command prompt in the directory where the file is located and run the following command in CLI.
````
$ ipfs add FILE_NAME

# Examples

$ ipfs add image.png
$ ipfs add note.txt
````
![image.png](https://cdn.utopian.io/posts/63c8c23b39d8e842022615d8072980104e2bimage.png)

With the HASH returned from the CLI, you can access your file via the local IPFS gateway.

http://localhost:8080/ipfs/ {HASH}

[http://localhost:8080/ipfs/QmWiqKzV1osgrzVrmzJRKgZXsvs8P6aKXGVDprFz9p2rgx](http://localhost:8080/ipfs/QmWiqKzV1osgrzVrmzJRKgZXsvs8P6aKXGVDprFz9p2rgx)

#### Track files from your local IPFS node with CLI
Tracking files from the local IPFS node is very easy with the CLI. To read a file, you only need HASH of that file. You can read the file with **ipfs cat FILE_HASH** command.
````
ipfs cat FILE_HASH
ipfs cat QmfDCcLFMFCASvuWuLzFeQcVyFb8Pj3cpPvLPFWozbTETY
````

An example is shown below. I uploaded a Markdown file to the IPFS node and tried to read it with "**ipfs cat**" command.

![image.png](https://cdn.utopian.io/posts/3a5afe10748cd261712704f423cef2ef7608image.png)

#### Curriculum

- [[IPFS Tutorial #2] - Build a NodeJS app for IPFS](https://utopian.io/utopian-io/@hsynterkr/ipfs-tutorial-2-build-a-nodejs-app-for-ipfs)
- [[IPFS Tutorial #1] - Host Your Images Online Forever with IPFS](https://utopian.io/utopian-io/@hsynterkr/host-your-images-online-forever-with-ipfs)

    
👍  , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authorhsynterkr
permlinkipfs-tutorial-3-using-the-ipfs-command-line-interface
categoryutopian-io
json_metadata"{"community":"busy","app":"busy/2.4.0","format":"markdown","repository":{"id":16722900,"name":"ipfs","full_name":"ipfs/ipfs","html_url":"https://github.com/ipfs/ipfs","fork":false,"owner":{"login":"ipfs"}},"pullRequests":[],"platform":"github","type":"tutorials","tags":["utopian-io","ipfs","blockchain","steemdev","steemia"],"users":["hsynterkr"],"links":["https://ipfs.io/ipfs/QmTgtbb4LckHaXh1YhpNcBu48cFY8zgT1Lh49q7q7ksf3M","https://ipfs.io/docs/install/","https://ipfs.io/docs/install/","http://localhost:8080/ipfs/","http://localhost:8080/ipfs/QmWiqKzV1osgrzVrmzJRKgZXsvs8P6aKXGVDprFz9p2rgx","https://utopian.io/utopian-io/@hsynterkr/ipfs-tutorial-2-build-a-nodejs-app-for-ipfs","https://utopian.io/utopian-io/@hsynterkr/host-your-images-online-forever-with-ipfs"],"image":["https://ipfs.io/ipfs/QmTgtbb4LckHaXh1YhpNcBu48cFY8zgT1Lh49q7q7ksf3M/raster-generated/ipfs-logo-text-512-ice.png","https://cdn.utopian.io/posts/73c6502190a45a5dc0d8e3e9c237ba88a892image.png","https://cdn.utopian.io/posts/73b5a46b7318dc54c44d9be8175c93efb5eaimage.png","https://cdn.utopian.io/posts/e7159910ea6b9cdb20b6fafdc94b1e9cfe13image.png","https://cdn.utopian.io/posts/63c8c23b39d8e842022615d8072980104e2bimage.png","https://cdn.utopian.io/posts/3a5afe10748cd261712704f423cef2ef7608image.png"],"moderator":{"account":"mcfarhat","time":"2018-05-01T09:54:39.590Z","pending":false,"reviewed":false,"flagged":true},"questions":null,"score":null,"total_influence":null,"staff_pick":null,"staff_pick_by":null,"config":{"questions":[{"question":"How many substantial concepts does this tutorial address?","question_id":"tuts-1","answers":[{"answer":"4-5 substantial concepts covered in the tutorial.","answer_id":"tuts-1-a-1","value":10},{"answer":"2-3 substantial concepts covered in the tutorial.","answer_id":"tuts-1-a-2","value":7},{"answer":"1 substantial concept covered in the tutorial.","answer_id":"tuts-1-a-3","value":3},{"answer":"More than 5 substantial concepts covered in the tutorial.","answer_id":"tuts-1-a-4","value":0}]},{"question":"Does the title and the outline of the tutorial properly reflect the content?","question_id":"tuts-2","answers":[{"answer":"Yes, it is very clear.","answer_id":"tuts-2-a-1","value":15},{"answer":"To some extent.","answer_id":"tuts-2-a-2","value":11.5},{"answer":"The title is somewhat misleading and/or the outline is not detailed or informative enough.","answer_id":"tuts-2-a-3","value":4.5},{"answer":"Title and outline are of little or no relevance to the content of the tutorial.","answer_id":"tuts-2-a-4","value":0}]},{"question":"Did the contributor provide supplementary resources, such as code and sample files in the contribution post or a linked GitHub repository?","question_id":"tuts-3","answers":[{"answer":"Yes, exceptional supplementary resources are provided including a relevant github repo/gist.","answer_id":"tuts-3-a-1","value":15},{"answer":"Supplementary resources provided are of high relevance.","answer_id":"tuts-3-a-2","value":12},{"answer":"Contributor provides minimal supplementary resources.","answer_id":"tuts-3-a-3","value":6},{"answer":"No supplementary resources were provided.","answer_id":"tuts-3-a-4","value":0}]},{"question":"Is the tutorial part of a series?","question_id":"tuts-4","answers":[{"answer":"Yes.","answer_id":"tuts-4-a-1","value":10},{"answer":"Yes, but it is the first entry in the series.","answer_id":"tuts-4-a-2","value":7},{"answer":"No, but it works just fine as a stand-alone tutorial.","answer_id":"tuts-4-a-3","value":5},{"answer":"No.","answer_id":"tuts-4-a-4","value":0}]},{"question":"Does the tutorial contain sufficient explanatory visuals?","question_id":"tuts-5","answers":[{"answer":"Yes, the visual components of the post were adequate in quality and quantity.","answer_id":"tuts-5-a-1","value":10},{"answer":"The volume of visual components included was unnecessarily large.","answer_id":"tuts-5-a-2","value":7},{"answer":"The post lacked sufficient visualization to easily learn from the content.","answer_id":"tuts-5-a-3","value":3},{"answer":"No visualization was presented in this contribution.","answer_id":"tuts-5-a-4","value":0}]},{"question":"How unique and/or innovative are the concepts covered in the tutorial?","question_id":"tuts-6","answers":[{"answer":"This was the first time I read about the concepts covered.","answer_id":"tuts-6-a-1","value":10},{"answer":"The concepts covered were innovative and offer some usefulness.","answer_id":"tuts-6-a-2","value":7},{"answer":"I have read several similar ideas and thoughts elsewhere, but this one was of higher quality.","answer_id":"tuts-6-a-3","value":5},{"answer":"Such tutorials can be found online with great ease and the contribution add no value to the open source community.","answer_id":"tuts-6-a-4","value":0}]},{"question":"How would you describe the formatting, language and overall presentation of the post?","question_id":"c-1","answers":[{"answer":"The post is of very high quality.","answer_id":"c-1-a-1","value":10},{"answer":"The post is of decent quality, but not spectacular in any way.","answer_id":"c-1-a-2","value":7},{"answer":"The post is poorly written and/or formatted, but readable.","answer_id":"c-1-a-3","value":3},{"answer":"The post is really hard to read and the content is barely understandable.","answer_id":"c-1-a-4","value":0}]},{"question":"How would you rate the overall value of this contribution on the open source community and ecosystem?","question_id":"c-2","answers":[{"answer":"This contribution brings great and impactful value, and can be used for applications outside the specific project.","answer_id":"c-2-a-1","value":20},{"answer":"This contribution adds significant value to the open source community and ecosystem, or is of critical importance to the specific project.","answer_id":"c-2-a-2","value":16},{"answer":"This contribution adds some value to the open source community and ecosystem or is only valuable to the specific project.","answer_id":"c-2-a-3","value":8},{"answer":"This contribution adds no value to the open source community and ecosystem or the specific project.","answer_id":"c-2-a-4","value":0}]}]}}"
created2018-05-01 04:34:27
last_update2018-05-01 17:53:36
depth0
children5
last_payout2018-05-08 04:34:27
cashout_time1969-12-31 23:59:59
total_payout_value0.786 HBD
curator_payout_value0.222 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,011
author_reputation12,645,130,948,582
root_title"[IPFS Tutorial #3] - Using the IPFS Command Line Interface"
beneficiaries
0.
accountutopian.pay
weight1,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,162,898
net_rshares196,288,871,052
author_curate_reward""
vote details (22)
@mcfarhat ·
$0.78
Thank you for your contribution, yet it cannot be accepted.
The concepts covered in this tutorial are too basic, and/or covered elsewhere on the web including but not limited to official documentation.
For instance, the basic setup and configuration was already covered in a prior tutorial of yours, but also available here as official documentation https://ipfs.io/docs/getting-started/
Files management and CLI interaction is well documented on the web, but also concepts covered here are too short and do not provide much added value overall.
We hope to see more innovative upcoming tutorials from your side :)

----------------------------------------------------------------------
Need help? Write a ticket on https://support.utopian.io.
Chat with us on [Discord](https://discord.gg/uTyJkNm).

**[[utopian-moderator]](https://utopian.io/moderators)**
👍  ,
properties (23)
authormcfarhat
permlinkre-hsynterkr-ipfs-tutorial-3-using-the-ipfs-command-line-interface-20180501t095756549z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-05-01 09:58:00
last_update2018-05-01 09:58:00
depth1
children1
last_payout2018-05-08 09:58:00
cashout_time1969-12-31 23:59:59
total_payout_value0.776 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length855
author_reputation150,651,671,367,256
root_title"[IPFS Tutorial #3] - Using the IPFS Command Line Interface"
beneficiaries
0.
accountutopian.pay
weight1,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,205,772
net_rshares208,047,836,389
author_curate_reward""
vote details (2)
@hsynterkr ·
After your comment, I noticed that it looked like documantation when I looked at my contribution. I will continue to write tutorials on application development such as my previous contributions. Thank you :)
properties (22)
authorhsynterkr
permlinkre-mcfarhat-re-hsynterkr-ipfs-tutorial-3-using-the-ipfs-command-line-interface-20180501t134412527z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-05-01 13:44:15
last_update2018-05-01 13:44:15
depth2
children0
last_payout2018-05-08 13:44:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length207
author_reputation12,645,130,948,582
root_title"[IPFS Tutorial #3] - Using the IPFS Command Line Interface"
beneficiaries
0.
accountutopian.pay
weight1,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,240,894
net_rshares0
@qurator-tier-0 ·
<div class="pull-left"><img src="![Qsmall.png](https://steemitimages.com/DQmcWoZUnPrRW1UdZeVPWhHpnXfkgWAdFHGxMrSgZoxSZw8/Qsmall.png)" /></div>
		
<center>You just received a Tier 0 upvote!  Looking for bigger rewards? Click [here](https://steemit.com/qurator/@qurator/qurator-tier-changes) and learn how to get them or visit us on [Discord](https://discord.gg/nhQehdv)</center>
properties (22)
authorqurator-tier-0
permlinkre-ipfs-tutorial-3-using-the-ipfs-command-line-interface-20180501t051707
categoryutopian-io
json_metadata""
created2018-05-01 05:17:09
last_update2018-05-01 05:17:09
depth1
children0
last_payout2018-05-08 05:17:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length377
author_reputation59,310,010,441
root_title"[IPFS Tutorial #3] - Using the IPFS Command Line Interface"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,168,314
net_rshares0
@thescholarlyowl ·
$1.16
Thanks @hsynterkr, loved your post. Keep up the good work.
👍  
👎  
properties (23)
authorthescholarlyowl
permlinkreipfs-tutorial-3-using-the-ipfs-command-line-interface1525167879886
categoryutopian-io
json_metadata""
created2018-05-01 09:44:42
last_update2018-05-01 09:44:42
depth1
children1
last_payout2018-05-08 09:44:42
cashout_time1969-12-31 23:59:59
total_payout_value0.870 HBD
curator_payout_value0.286 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length58
author_reputation357,589,094,032
root_title"[IPFS Tutorial #3] - Using the IPFS Command Line Interface"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,203,885
net_rshares198,777,667,655
author_curate_reward""
vote details (2)
@pleasestop · (edited)
#### Please Stop

In your [your last 100 comments](https://steemit.com/@thescholarlyowl/comments) you used 62 phrases considered to be spam. [You've received 0 flags](https://multi.tube/s/api/account-incoming-downvotes/thescholarlyowl) and you may see more on comments like these. These comments are the reason why your [Steem Sincerity API](https://steemit.com/steemdev/@andybets/steem-sincerity-improved-anti-spam-api) [classification scores](https://multi.tube/s/api/accounts-info/thescholarlyowl) are **Spam:** 56.20% and **Bot:** 2.60%

Please stop making comments like this and read the [ways to avoid @pleasestop](https://steemit.com/spam/@pleasestop/ways-to-avoid-pleasestop) and earn the support of the community.
properties (22)
authorpleasestop
permlinkk13zshsxzxhg3ihzoikmhnggt17ugqyn-post
categoryutopian-io
json_metadata{"app":"pleasestop"}
created2018-05-01 09:44:48
last_update2018-05-01 17:48:39
depth2
children0
last_payout2018-05-08 09:44:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length722
author_reputation793,172,990,523
root_title"[IPFS Tutorial #3] - Using the IPFS Command Line Interface"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,203,905
net_rshares0