Command Line Cheat Sheet – CLI Commands for Easy Reference
What Is a Command Line Interface?
A command line interface (CLI) is a computer's text interface allowing you to type commands for the computer to run.
Below is an image of the Windows PowerShell terminal application.
Command line interfaces are sometimes called terminals.
Syntax of a Terminal's Command
A terminal's command comprises three components: a utility, a flag, and an argument.
Here is the syntax:
utility -flag argument
Note the following:
utilitytells the computer the function you want it to run. Many CLI commands require only a
utility's mode of operation. In other words, we use flags to specify preferences on how computers should run the
Flags always start with one or two hyphens (
Flags are typically written after the
utilitycommand and before an
argumentsays the exact action the
utilitycommand should perform.
Let's now see some of the widely used commands.
Directory Management Commands
Below are the commands for creating, accessing, and deleting directories on your system.
Directories are sometimes called folders.
|Check the current working directory's path|
Change directory from the current working directory to
|Change directory from the current working directory to its parent directory|
The whitespace between
The duplicated directory will overwrite an existing directory with the same name.
|Remove a directory permanently from your system|
|Remove a directory permanently and forcefully from your system|
|List out the current directory's content|
|List out the current directory's content using the long listing format|
|List out all the current directory's content—including all hidden content|
|List out all the current directory's content using the long listing format. Also, include all hidden content|
|Make a new directory|
Files Management Commands
Below are the commands for creating, accessing, and deleting your system's files.
|Create a new file|
|Copy a file into a specific directory|
The duplicated file will overwrite an existing file with the same name.
|Display all the content in a specific file|
|Display some of the content in a specific file|
|Display the first ten (10) lines of a specific file|
|Display the last ten (10) lines of a specific file|
|Move a file into a new directory|
The moved file will overwrite an existing file with the same name.
|Remove a file permanently from your system|
|Remove a file permanently and forcefully from your system|
|Rename a file|
Below are the commands for downloading and testing network resources.
|Download a file|
The -O flag must be in uppercase.
|Test a network host's reachability|
System Information Commands
Below are the commands for displaying your system's information.
|Display the current date and time|
|Display your CPU's information|
|Display your memory's information|
|Display your system's disks usage information|
|Display your current directory's space usage information|
|Clear your terminal's content|