Photo by Jake Walker on Unsplash
Basic Guide and Commands
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.
Below, you will see images showing examples of the Graphical Interface (GUI) and the Command Line Interface (CLI) in both Mac and Windows.
Examples of (GUI) in Mac and Windows
(GUI) Mac Graphical Interface
(GUI) Windows Graphical Interface
You can notice the difference between the graphical interfaces of the operating systems.
Examples of (CLI) in Mac and Windows
Mac Interface Command Line known as "Terminal"
Windows Interface Command Line known as "Command Prompt"
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.
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".
This line deletes all documents that match this extension.
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.
As you can see below, the indicators vary in the information they present.
Windows Indicator:
These images show how clearly the body of the Windows indicator is detailed.
Mac/Linux Prompt Indicator:
These images show how clearly the body of the Mac/Linux indicator is detailed.
Top comments (0)