Command line

Updated: 04/01/2018 by Computer Hope

Windows DOS command prompt windowSometimes referred to as the command screen or a text interface, the command line or Windows command line is a user interface that is navigated by typing commands at prompts, instead of using the mouse. For example, the Windows folder in a Windows command line is C:\Windows> (as shown in the picture) and in Unix or Linux, it may be % or >. Unlike a GUI operating system, a command line only uses a keyboard to navigate by entering commands and does not utilize a mouse for navigating.

Why do people use the command line?

Because a command line interface requires unique commands for different operations, this interface is often more difficult to learn because of the need to memorize dozens of different commands. However, a command line operating system can be a very valuable resource and should not be ignored. For example, users who have Microsoft Windows may find a task such as renaming 100+ files in a folder, a very difficult task. However, renaming 100+ files in a directory can be done in less than a minute with a command entered into the command line.

The command line is still used even today because it is still easier for someone who is familiar with a command line to perform tasks that may be possible in a GUI but can be done faster in a CLI or automated using scripts.

Example of doing a task in the command line

For someone with little or no experience with a command line it may be difficult to grasp how the command line is used. Below is an overview to help demonstrate a task done in the Windows command line and in the Windows GUI.

Move all .txt files to a backup directory in a Windows command line

  1. Open the Windows command line.
  2. Move to the directory containing the .txt files using the cd command. For example, you could move to the hope users documents by typing "cd\users\hope\documents" at the prompt.
  3. Once in the directory if a backup directory did not exist you could use the md command and type "md backup" to make a new backup directory.
  4. Finally, to move all .txt files you could use the move command and type "move *.txt backup" to move all .txt files to the backup folder. The * is used as a wildcard.

Move all .txt files to a backup folder in a Windows

For a comparison to the above command line steps. Below are the steps on how to perform the same action (moving .txt files) in Windows.

  1. Open Windows Explorer.
  2. Open the drive and folder containing the .txt files. For example, you could move into the C: drive and then the Users folder, Hope folder, and then Documents folder to open the documents for the hope user.
  3. Once in the folder if a backup folder did not exist you could right-click in the folder and click New and then Folder and name it backup to create a new backup folder.
  4. If Windows Explorer is not showing the files in the Details view click the View tab and select Details.
  5. Click the Type column to browse files by type.
  6. Highlight all .txt files.
  7. Right-click on the highlighted and select Cut.
  8. Open the backup folder and in that folder right-click and click Paste to move all files into that folder.

As demonstrated in the above two examples performing the same task in a command line does require learning at least three commands. However, once these commands are known it requires less steps in a command line than in a Windows. In addition these same commands could be used in a batch file or other scripting language to automate the process. For example, you could automate the process of backing up files by copying the files instead of moving them. Once the commands have been written in a batch file all you would need to do is double-click the batch file to perform all the copying.

Command line commands

There are hundreds of different commands that can be used in a command line. Remembering all of the commands, syntax, and options of every command would be impossible, which is why we've created the below pages. Below are links to our Windows command line, MS-DOS, Linux, and Unix command listings. Each of these pages has hundreds of commands with full syntax and examples of how to use each command.

Text interface with menus in a command line

A text interface can be made easier to navigate using menus created with text and ASCII extended characters. For example, many command line text editors use an interface with menus and shortcut keys that make navigating the file being edited easier. The picture below is an example of the MS-DOS editor used to edit files while at the MS-DOS or Windows command line.

MS-DOS edit command window

Although a text interface with menus has a lot more visual appeal than the command line, this interface is still considered a text interface and not a graphical interface.

Should I learn a command line?

We're strong believers that you should learn as much as you can about computers to make using a computer easier. Having just a basic understanding of the command line from reading this page gives you a much greater advantage than someone who is unfamiliar with its capabilities. Below are some reasons you may want to learn even more about the command line.

  • You need ways to manage files faster and easier on a computer.
  • You work with computers remotely.
  • Manage files on a file server or web server (e.g., managing a web page).
  • Need to automate commonly performed tasks.
  • Want to learn even more about computers.

Argument, CUI, Elevated command prompt, MS-DOS, Operating system terms, Virtual real mode