Question: how to get a command block in minecraft survival mode?
Answer: You must have cheats enabled. ... 
The command would look like.
/give @p command_block 64.
I think you may need to be in creative mode in order to “program” the command block. ... 
/gamemode creative.
You can activate command blocks by the usual redstone methods.