The Minecraft Chat menu has a useful feature for writing commands without consulting various guides. The Tab key allows you to automatically complete commands and parameters with a single button. This makes it efficient and extremely useful to write complicated commands in chat, and then copy and paste them into command blocks with Ctrl-A (select all), Ctrl-C (copy), and Ctrl-V (paste).
If you start to type a command or parameter and then press Tab, you can see a list of every possible option, and the first one is automatically added to your command. If this isn’t the one you wanted, you can keep pressing Tab to cycle through the options until you have the right one.
For example, if you open the Chat menu, enter a slash (/) and press Tab, you can see a list of all available commands. Similarly, if you type /te and press Tab, you can select a command from /testfor, /tellraw, /tell, /testforblock, and /testforblocks.
Autocompleting doesn’t work if there’s anything to the right of the cursor. You can autocomplete only what is currently the last word of the command.
The same statement applies to parameters with a finite number of options. These parameters include
Blocks and items: If a command requires a certain block or item as a parameter, you can find it with autocompletion. All block and item names are of the form minecraft:<name>. Press Tab to autocomplete the minecraft: part, and then autocomplete the rest as you would normally.
Achievements and statistics: Like blocks and items, achievements are of the form achievement:<name> and statistics are of the form stat:<name>.
Booleans: Parameters that can be either true or false are easy to autocomplete.
Player names: If a command requests the name of a player, you can use autocomplete to select one from the list of all players in the world.
Command-specific parameters: Some parameters can take only specific values, such as replace or masked. You can use autocomplete to see all available options for parameters like this.
When autocompleting a parameter, be sure to enter a space after the previous word in the command; otherwise, the game won’t understand what you’re trying to do.