Shell and terminal

Shell and terminal

Funny enough, I thought these two were the same, like one thing. But under the hood, these are two different things that share most similarities. Think of them as your backstage pass to the inner workings of your computer – where real magic happens!

What is a Shell?

Shell is a user interface for access to an operating system's services. It is a program that takes commands you type and sends them to your operating system to execute. It's a text-based interface for controlling your computer.

Things to know about shell:

  1. Command Interpretation: Shells interpret commands entered by users and execute them. These commands include navigating the file system, running programs, managing files, and more.

  2. Scripting: Shells also allow users to create scripts, which are sequences of commands stored in a file. These scripts can be executed to automate tasks or perform complex operations.

  3. Customization: Users can often customize their shell environment by setting environment variables, defining aliases for commonly used commands, and configuring various options to suit their preferences.

  4. Types of Shells: There are different types of shells available, with some of the most common ones being:

    • Bourne Shell (sh): The original Unix shell.

    • Bash (Bourne Again Shell): A popular Unix shell that is backwards-compatible with the Bourne Shell but includes additional features.

    • Zsh (Z Shell): An extended version of the Bourne Shell with many improvements and additional features for interactive use.

    • Fish (Friendly Interactive Shell): A modern and user-friendly shell with features like syntax highlighting and autosuggestions.

    • PowerShell: A shell developed by Microsoft primarily for Windows systems, with an emphasis on automation and integration with .NET.

  5. Graphical Shells: While traditional shells are command-line interfaces, graphical shells provide a graphical user interface (GUI) for interacting with the operating system. These interfaces often include icons, windows, menus, and other visual elements for performing tasks.

What is a Terminal?

A terminal, or terminal emulator, is a program that gives you a window where you can type commands and see the output. It's like a dashboard where you interact with the shell. Popular terminal emulators include:

  • macOS Terminal (Built-in)

  • Windows Terminal (Modern terminal for Windows)

  • iTerm2 (MacOS alternative)

  • Hyper (Highly customizable, cross-platform)

The terminal is your visual interface to the shell. It's where you'll see your commands, any error messages, and the results of your actions.

Why Use the Shell and Terminal?

  • Efficiency: A single command can accomplish many tasks that take several clicks in a GUI.

  • Automation: Shells are fantastic for scripting, automating repetitive tasks and saving time.

  • Power: Using the command line, you often have more granular control over your system.

  • Remote Access: Terminals let you remotely access and manage servers or other computers.

Basic Commands to Get Started

Ready to try it out? Here are some essential commands to experiment with:

  • ls - List files and directories

  • cd - Change directory

  • mkdir - Make a new directory

  • touch - Create a new file

  • rm - Delete files or directories

The shell is your command interpreter, while the terminal is the application where you interact with it. Mastering the command line might seem daunting at first, but the journey is worth the effort. Start with the basics and gradually expand your command vocabulary. You'll be amazed at how much more efficient you can become!

Did you find this article valuable?

Support Nicanor Korir by becoming a sponsor. Any amount is appreciated!