Please enable JavaScript to use CodeHS

Command Line Interface

In this tutorial, you'll learn how to use the command line interface to interact with files and folders, and access information about computer processes.

By Jennifer Campbell

The Command Line Interface

Computers today most commonly use a Graphical User Interface, or GUI, which provides a simpler way to use the system.

Each graphic is a “window” of sorts where the user can view the contents of the computer instead of having to type in a bunch of commands to open and run programs. Before the GUI was a Command Line Interface. This looks and runs a lot differently and is still used in many Linux systems and by professionals such as network administrators.

A command line interface, or CLI, is a different way of interacting with a computer. All commands are text-based. In fact, you don’t need the mouse at all!

Even though most users prefer a graphical user interface, the CLI is still used by many advanced users and can be very beneficial in managing computer networks and systems. Using the Command Line Interface, we can interact with the operating system by accessing, changing, and moving files without clicking on any icons. When using CLI commands, capitalization and spacing is important.

There are commands that will list the contents of a folder. You can also change folders and move around in the directory. You can print the path of the current folder, copy or move a file as well.

There are other commands that don’t involve just your files and folders. Some can offer you information about your computer. The ps command can be very useful as it provides information on programs that are running. This allows you to see if a program is frozen or unresponsive and you can actually close that program from the terminal!


Linux/MacOS vs. Windows

The look and functionality of a command line interface, or CLI, varies depending on the operating system used. Each CLI uses its own command syntax, but they all function in a similar way. Here is a comparison of the different commands used on a Linux/MacOS vs. a Windows operating system.


CLI Detective

Watch the following video and follow along with the prompts.

Answer the following questions based on the video.

  1. What did the person using the Windows Command Prompt do during Round 1?
  2. What did they do during Round 2?

Answers are at the bottom.


Explore a Terminal!

Try out the different commands listed above. Type the commands in the code editor on the left and click on the Run button to run the commands. There is an example in there to start.


If you’d like to learn more things that you can do using the command line interface, check out this tutorial.

Command Line Detective Answers:

  1. The person first checked to see what files and folders were in their current folder which was the Cyber folder. Then, the changed folder and went into the tracy folder. They then checked to see what files and folders were in the tracy folder.

  2. The person copied the file called tracyPic.jpg from the tracy folder into the karel folder while renaming it copiedTracy.jpg.