See all glossary terms

Command Line

Learning to use the command line is not urgent: you can do a lot without ever touching it. But in your dev journey, it's almost impossible to imagine that you will never have to do a bit of command line.
You will use the command line to process files, to export games automatically, to reduce images, and so on.
The command line is a text interface for your computer. It's how computers used to be controlled, and it's still the interface of choice for many operations.
There are a few excellent benefits to a text interface. Firstly, instructions. Instead of telling people to click here, click there, do this, do that, you can give them the instruction, and they can copy-past it. Secondly, you can have many options in a text-based interface, where it would be overwhelming in a UI. Finally, command line programs are composable. Using GUIs, you can export an image from a program and put it in another, but using the command line, you can directly connect them in one command.
The command line is a bit like a programming language. You have commands, options, and arguments. You can use something called "pipes" to connect commands, and you can use redirection to send the output of a command to a file.
To use the command line, we use something called a "terminal emulator". It's an emulator, because it emulates the old terminals that were used to control computers. On Windows, they call them "Command Prompt". Emulators run various programs called "shells". Shells are sort of like different programming languages. They all work kind of like each other, with some differences.

Basics of Shells

Practically all shells have the same few concepts. When you open one, you see a prompt. It's a bit like a cursor in a text editor. It shows you where you can type. You type a command, and you press enter. The shell runs the command, and it shows you the output. If the command is successful, it shows you a new prompt.
The default Bash prompt 9(on Linux and Mac) is often:
[name@host ~]$
Where "name" is your username, and "host" is the computer's name.
On Windows, the prompt is like this:
c:/>
To navigate in directories, you use the cd command, or "change directory". cd my_dir will make my_dir the directory you're in. You can use relative paths, or absolute paths from the root.
To go back one directory, you can use cd ... To list the files in a directory, you can use the ls command. On Windows, you can use dir.
To run a program, you can type the name of the program. If the program is in the current directory, you can type ./program_name. Otherwise, you need to call it from its location, like so:
[name@host ~]$/home/user/program_name
Or, on Windows:
c:/>C:\Users\user\program_name.exe
Some programs are in your PATH. Any directory added to your PATH is globally accessible. To add programs to your path, check the documentation for your operating system and shell.
It's a good idea to add Godot to your PATH if you want to be able to use it from the command line.
Each program can do whatever it wants, but there are some conventions that most programs try to follow:
  • You can add flags with the --flag syntax. Flags often have a shorthand like -f.
  • Some flags can take options like --mode verbose. These also often have a shorthand, like -m verbose.
  • You can pass arguments to a program. Arguments usually come at the end, after all flags and options.
  • Most programs allow to pass --help to get an idea of their main arguments. For more, check the documentation of the specific program.