This is how we know that we know him: if we keep his commandments.
Hereby we know ... Similar words are used several times in this letter to introduce "tests" by which the validity of one's faith might be tested (1 John 2:5,29;  1 John 3:19,24;  1 John 4:2,6,13, and  1 John 5:2).  In the last analysis, it is keeping the commandments of the Lord, walking in the light, doing the truth, obeying the word, etc., which are the final determinator of whether one is saved or lost.  Which commandments are meant?  All of them.  There is no way to limit these to the ethical or moral commandments; those relating to the worship of God are likewise included.  To keep God's commandments is equivalent to keeping his word, "And this means the truth of God as it is in Christ."[14] The obligation extends to the entirety of the New Testament revelation.