Command Line¶
Introduction¶
There are two ways to interact with a computer via its operating system: GUI (graphic user interface) and CLI (command line interface). CLI is often called shell because it works as a shell of an operating system to let advanced users, administrators and programmers to use the computer.
There are several CLI/shells for each computer operating system. Windows comes with the command prompt (cmd
) and power shell. MacOS and Linux/Unix have bash
, csh
and zsh
etc. The default shell for new MacOS is zsh
. Old MacOS uses bash
.
Windows 10 comes with two CLI applications: cmd
command line and powershell
. cmd
is a very old and simple CLI that is enough for many development tasks. powershell
is new and more powerful but not compatible with cmd
. It is only used by advanced Windows developers. Some Windows Applications may install a shell. For example, the Git client for Windows installs a bash
. Additionally Windows 10 can install a Windows subsystem for Linux (WSL) to use Linux shells.
Things a Programmer Should Know¶
A programmer is a power user of a computer. Often the CLI is the most efficient, sometimes the only way in case a server doesn't have a GUI subsystem, to run different tools/applications. The good news is that you only need to know some basic commands accomplish most programming tasks. The commands include the following:
- navigate and list directories/files. A directory is also called a folder and folders are organized in a tree structure that the top folder is called the root folder
/
in MacOS/linux and\
in Windows. - create, move and delete directories/files.
- set/delete environment variables. The most useful environment variable is
path
. An operating system usespath
to find the location to execute a command.
Learn CLI¶
Windows Command Prompt¶
To learn the Windows command line cmd
, watch the YouTube videos Windows Command Line Tutorials. The first four videos are enough and totally take about 20 minutes.
MacOS/Linux CLI¶
The Absolute BEGINNER Guide to the Mac OS Terminal is a good start for beginners.
The Missing Semester of Your CS Education¶
To become a real advanced user of your computer, you need to learn a little bit more. The The Missing Semester of Your CS Education is an introduction course in MIT. It has the text and videos of learning the basic tools for programming.
The first 6 lessons are useful, for now and for a long time in your professional career. You won't regret if you learn it.