Skip to main content

What is a command-line interface?

The Harvard Chan AI Glossary

In our classes, we often pause to explain the ideas behind AI and the language used to describe it. These posts grew out of those conversations. They’re for anyone who would like to understand AI better, with no technical background assumed.

A command-line interface, or CLI, is a way to operate software by typing commands rather than primarily clicking buttons. It is commonly used through a terminal window. The command tells a program what to do, and the program returns information, performs an action or reports an error.

For example, a command can list the files in a folder, start a development application or run tests. Tests are checks that compare actual behavior with expected behavior. The precise command depends on the operating system and program, so copying unfamiliar instructions without understanding them can have unintended effects.

A command may include arguments, which are values supplied to the program, such as a filename. It may also include options that modify how the operation runs. These are conventions for directing software, not evidence that the command-line version is inherently more intelligent than a graphical alternative.

The terminal and the shell are related but different. The terminal provides the text-based interaction. The shell interprets commands and starts programs. Many people use “terminal” informally to describe the whole experience, which is usually sufficient until a technical problem requires the distinction.

A coding agent can itself be accessed through a CLI. In that case, the person may type ordinary-language requests to the agent, while the agent uses commands to inspect or modify the project. Command-line and graphical interfaces are ways of interacting with agents, not separate model categories.

Text-based operation can make repeated tasks easier to record and automate. A script is a saved sequence of instructions that can be run again. That repeatability is useful, but it also means a mistaken command can repeat a harmful action efficiently.

The working folder and permissions matter. A command that affects the intended test folder is different from one affecting unrelated files. Before allowing an AI agent to run commands, understand what it can access and how consequential operations are controlled. A CLI is a method for operating software. Its usefulness depends on the program, the task and the safeguards around execution.

If you would like to find out more about AI and improve your leadership skills, consider the AI in Health Care Certificate of Specialization from the Advanced Learning Academy at Harvard T.H. Chan School of Public Health. You can take an individual course or work toward the full certificate.


AI is a fast-moving field. This explanation reflects our class discussions and related material at the time of writing. Terminology, capabilities and tools may change.

For suggested additions or corrections, please email me at tpanch@hsph.harvard.edu.

Dr. Trishan Panch
Program Director, AI in Health Care
Harvard T.H. Chan School of Public Health — Advanced Learning Academy