You can try to memorize the syntax but that won't give you much understanding on why things are that way leading to brittle knowledge that quickly goes away.
Practice, on the other hand, directly develops the understanding and familiarity with the subject as you get to see hands-on how things work and when you make mistakes you learn why things are the way they are.
I'm pretty sure almost nobody thinks consciously of how to work their mouth muscles in order to talk, they just think of the words. That's what practice gets you.
You gain that comprehension through practice first and then you polish it by trying to explain it to someone else.
I know I'll write tons of toy programs to teach myself a concept before I try to explain it to someone, just like I'll try every position of a scale until I can effortlessly play it before I try to show it off.
You'll probably have to make some judgment calls about what's worth keeping in that cognitive space, though. For commands you use all the time, you should know the syntax without even thinking about it. For things you use only rarely, it's a better use of your time to just look it up. If you use it semi-regularly, look it up, bookmark it, and eventually you'll just memorize it.