Question: how to get a command block in minecraft in your inventory?
Answer: Type/give <your username> command_block. If you opened the Chat menu with the Open Command key (which is / by default) rather than the T key, the slash at the beginning is entered automatically. Press Enter. The command block should appear in the inventory.