Basic Guide to Most Used Commands in CLI Command Line Interface on Mac and Windows
Tags: tutorial, beginners, cybersecurity, softwareengineering
Published: 2023-11-15 02:17:29



###### Photo by Jake Walker on Unsplash

<br/><br/><br/><br/><br/><br/>

# Basic Guide and Commands
<br/>
This article contains valuable information to prepare you for familiarizing yourself with the **_Command Line Interface_ (CLI)** and the most commonly used basics in both _MAC_ and _Windows_. Below, I will show you the commands and examples for each of them.

Most users are accustomed to using the *Graphical User Interface* commonly known as (**_GUI_**) in English. This interface is very user-friendly as you can easily see folders and files. However, for application developers, it is essential to step out of their comfort zone and use the **_Command Line Interface_** known by its initials in English as (**_CLI_**) instead of the graphical interface.
<br/><br/>
Below, you will see images showing examples of the **Graphical Interface (_GUI_)** and the **Command Line Interface (_CLI_)** in both **_Mac_** and **_Windows_**.
<br/><br/>


### Examples of (GUI) in Mac and Windows
<br/><br/><br/>

![GUI-MAC](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uzwyspvfgm2lhnlpa9u6.png)
######(_GUI_) Mac Graphical Interface
<br/><br/><br/>

    

![GUI-WIN](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i73g07ohcq0nhem58mk5.png)
######(_GUI_) Windows Graphical Interface
<br/><br/><br/><br/><br/>

You can notice the difference between the graphical interfaces of the operating systems.
<br/>

### Examples of (CLI) in Mac and Windows
<br/><br/>


![CLI-MAC](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5i69evzq5mjfyc49syy9.png)
######Mac Interface Command Line known as "Terminal"
<br/><br/><br/><br/>



![CLI-WIN](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/srnthjp5x36mdrcopohs.png)
######Windows Interface Command Line known as "Command Prompt"

<br/><br/><br/><br/>
## Commands

Interacting with the *Command Line Interface* is different from the graphical interface. In the graphical interface, you can see documents and folders as icons, and you can drag and click to make changes such as delete, rename, and perform other actions. In the (_CLI_), you need to enter commands to make changes. 


![Parts of the command 1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bnozreisewwudh8q3r9e.png)

Each command in a _CLI_ often has more than one part. The required part is the name of the command to execute. There are commands to perform various tasks, from displaying files in a directory to copying, renaming, moving, deleting, compressing, decompressing, and transferring them. Each of these commands is a small program that performs a specialized task.

The parameters are arbitrary and are determined by the command. Many commands support a pattern that matches one or more files in a directory. In this case, the parameter specifies a pattern that matches a file starting with any name but ending in .jpg.

  
>   For example, if you want to delete all documents with the `.jpg` extension, you can do it as follows. 
- **_Windows_**: `del *.jpg` 
- **_Mac_**: `rm *.jpg`.

The image below details the structure of a command in "**_CMD_**".


![Detailed command sructure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wc6he0buds7c462yhj5a.png)
######This line deletes all documents that match this extension.

<br/><br/><br/>
#### Command Table


|   Windows Command  |  MacOS/Linux Command  |  Description  |
| ------------- |:-------------:| -----:|
|  dir    | ls | Displays files in the current directory (by default, the current directory) |
| cd   | cd      |  Change directory or folder |
| move | mv | Moves a file to a new location (possibly with a new name) |
|copy|cp| Copy the document|
|del|rm| Delete or remove a document or folder|
|..|..| Navigate to the parent directory.|
|mkdir|mkdir|Create a directory or folder|


### Flags:

One of the essential features of a *flag* is to indicate which part of your hard drive the terminal considers the current directory. When you use commands like `del` or `rm`, unless you specify a different location, the command will be executed in the current directory.
<br/>
As you can see below, the indicators vary in the information they present. 
###### Windows Indicator:
<br/>
<!--pic of Win-->

![Windows terminal path](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9w3nz01vxxf9ft0ic30m.png)
These images show how clearly the body of the **_Windows_** indicator is detailed.
<br/><br/><br/>
###### Mac/Linux Prompt Indicator:

<!-- pic of Mac-->

![Mac terminal path](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t0ham1s19nlappoysqhz.png)
These images show how clearly the body of the **_Mac/Linux_** indicator is detailed.

<br/><br/>

### Follow me on:

<br/><br/>
<br/><br/> 



[LinkedIn](https://www.linkedin.com/in/mailing-delgado-medina/)
[GitHub](https://github.com/MailingDelgadoMedina)