Coding Basics-Part 2

·

4 min read

Introduction

You have already installed terminals for your operating system, whether it's Mac (iTerm), Ubuntu (Terminator), or Windows. In this guide, we will briefly explain what terminals are and why we will use them.

Check this video by Jesse Showalter that explains really well on how to use our terminal:-

Terminal emulators

Terminal emulators (synonyms are a terminal application or only term) provide text-based access to the operating system (in contrast to the mostly graphical nature of the user experience of any Operating System, which is managed with your mouse/trackpad).

Terminal emulators provide a command-line interface to the operating system. It is used in conjunction with a Unix shell, such as bash or ZSH.

Command line

The command-line is a handy tool included in your Operating System. It provides a vast number of functionalities for interacting with your computer, giving the user lots of power.

Command Line Interface (CLI)

The Command Line Interface, or CLI is a terminal program that provides an interface that allows us to type text commands to our computer.

More straightforward explanations would be - CLI is a tool in which you can type text commands to perform specific tasks (ex. create and navigate through files and folders, open files, etc.)

When using your computer, you commonly point and click on graphic elements with the mouse to perform tasks (create, move, delete folders and files, execute applications, etc.). When you do that, you are using a GUI (Graphical User Interface), and its use can be replaced by the CLI.

In simple English, it is the way users can communicate with their computers: it provides a place where you, as a user, can type a command (but not any command, it needs to be a command understandable for computer), and then the computer will execute these commands.

You might ask now - why would I type commands if I can use a mouse pointer and tell my computer what to do?

Well, believe it or not, soon you will see, it can be much faster to complete some tasks using CLI than with graphical applications and menus. Another benefit is allowing access to many more commands and scripts.

In the very beginning, we defined CLI as a terminal program, but we didn't specify where this program can and should be installed. Each operating system (Mac, Windows, Unix/Linux) has a particular terminal program already included in itself:

  • Windows includes the program "cmd.exe", which is a CLI that can be used to run DOS commands.

  • Mac OS X includes a program called "Terminal", which is used to run commands within the Mac OS.

  • Unix typically includes a program called "xterm", which can run BASH or other Unix shells.

🐚 Shell is a program that processes commands and returns the output.

💡 A terminal emulator/terminal is a program that opens a window and lets you interact with the shell. Terminal provides a Command Line Interface to the operating system.

Opening a terminal

To get started with the command line, you’ll need to open the terminal window.

👍 When you run your terminal application, your command prompt will start up pointing to a specific folder. From there, you can navigate between folders, act on files inside these folders, or perform other actions.

  • iTerm2

To open a terminal session in Mac OS, click on the Spotlight Search and type iTerm2. A new iTerm2 Terminal window will appear.

  • Terminator

To open a terminal session in Linux, open the Search bar and type Terminator:

A new Terminator window will appear. It is recommended to fix the icon in the menu bar to have quick access to your terminal.

Our first commands (applies to all OS)

⚠️ You do not need to type the $ character when entering these commands. The terminal will automatically populate this character to let you know where your cursor is in the terminal.

$ whoami
// This command will return your login name

$ pwd
// This command will return the path to the current folder
// you are working on

$ ls
// This command will list all the files and folders in the current 
//directory

This guide explains the basics of terminal emulators, command line interfaces, and how to open and use terminals on Mac, Linux, and Windows operating systems. It also provides a brief overview of common commands, resources for software development career paths, and optional customization tips for Terminator.

Extra resources