Intro to the Terminal
Published: 2024-04-15 03:41:46

---

Historically, a terminal was this physical device that consisted of a tad more than a keyboard and monitor and used to input and transcribe from, data in a computing system. But, now the concept has been absorbed into software. Ultimately, a terminal is a serial computer interface, to an implied operating system, that accepts text inputs to issue commands to a desired Command-line interpreter or _shell_.

**What’s the shell?**
A [shell](https://en.wikipedia.org/wiki/Shell_(computing)) is a computer program, living in the outermost layer of a computers operating system, that spills the beans on operating system's service for a user or a program. This is achieved either through a command-line interpreter(CLI) or Graphical User Interface(GUI), depending on the operation. There are various Unix System shells such as Bash, zsh, Ksh, tcsh, etc.

<u>*Bash Shell*</u>

A [POSIX](https://en.wikipedia.org/wiki/POSIX)-compliant, command processor, that generally runs in a text window, or console that accepts commands to perform actions. [Bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell)) is usually the default for most Unix & Linux distributions and like many other Unix shells, Bash supports command substitution, iteration, filename [globbing](https://en.wikipedia.org/wiki/Glob_(programming)), etc.

> "written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell. The shell's name is an acronym for "[Bourne-Again SHell](https://en.wikipedia.org/wiki/Bash_(Unix_shell)#:~:text=The%20shell%27s%20name%20is%20an%20acronym%20for%20Bourne%2DAgain%20SHell%2C%20a%20pun%20on%20the%20name%20of%20the%20Bourne%20shell%20that%20it%20replaces%5B17%5D%20and%20the%20notion%20of%20being%20%22born%20again%22)", a pun on the name of the Bourne shell that it replaces and the notion of being "born again".

<u>*Z Shell*</u>

Similar to Bash, Z Shell(zsh) is an extended Bourne shell containing improvements and combined features from the Korn Shell(ksh) and tcsh(Tenex-csh). The healthy combination brings the functionality of updated variable array handling, extended [globbing](https://en.wikipedia.org/wiki/Glob_(programming)), command-line completion, and customizable prompts. After the release of macOS Catalina, zsh was adopted as the default login shell.

**<u>Options</u>**

Additional items can be installed through the terminal to further improve performance like [VIM](https://www.vim.org/) and [NPM](https://docs.npmjs.com/about-npm).

VIM is an open-source text editor reincarnated from the original Vi editor that supports both graphical and text interfaces on any platform. Though it is challenging to master and is known to give the worst first impression, it provides commands for complex text-related tasks, and it is highly customizable and scalable. Luckily VIM has 'games' that you can utilize to improve proficiency such as [VIM-Adventures](https://vim-adventures.com/) or even simply running `$ vimtutor` in your shell prompt.


![$vimtutor](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/34qh14sj0j3pyd4nv5jl.png)

Node Package Manager is undoubtedly the largest software library and maintains it's place as the default for JavaScript. Containing it's own Command line client to download and install any of the 800,000 code packages or any software shared by developers. With that being said, Node.js is required to install NPM, but another tool that is available called Node Version Manager. Node Version Manager, or NVM, allows developers to switch between multiple versions of Node.js on one machine. Though Node.js can be used on both front-end and back-end, [Bower](https://bower.io/) can be installed through NPM which is a package manager optimized for front-end development. Now, NPM may be the largest and most used package manager today, but there are other options available. Such as [Yarn](https://yarnpkg.com/), which is an updated, faster NPM. And [PNPM](https://pnpm.io/), a newer NPM with a different package resolution algorithm for more speed and efficiency. Obviously the best choice depends on personal preferences and needs


![NPM vs Yarn vs PNPM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k2wvoer8nx8cw1j2e43m.png)


**Terminal Shortcuts**
Here is a short list of just a few of the shortcuts and commands for your terminal:

<u>_Manual Commands_</u>

```
Up Arrow // Shows previous command
Down Arrow // Shows next command
Tab // auto-complete current command
Ctrl + R  // Terminal search command
Ctrl + C  // Cancels Commands
Ctrl + L  // Clears the terminal
Ctrl + D  // Exits the terminal
Ctrl + Shift + ` // Open/create new terminal
Ctrl + a  // Navigates to beginning of command line
Ctrl + e  // Navigated to the end of command line
Ctrl + t  // Swap the last two characters before curser
Alt + t   // change positions of current word with previous
```

<u>_File Navigation_</u>

```
man   // shows the manual of Linux/Mac commands
ls    // List all files/directories under a designated directory
pwd   // Prints the working directory
whoami // Shows the current logged in user
ls -a  // List files including hidden ones
cd <directoryName> // Change directory
cd~    // Change to home directory
cd ..  // Revert to parent directory
```

<u>_Modifying_</u>

```
touch <fileName>  // Create a file
rm <fileName>     // Remove the file
cp <filename><directoryName> // Copy file
mv <filename><directoryName> // Move file
mkdir    // Create a directory
rm -r <directoryName> // Remove directory
rm -rf <directoryName> // Remove directory & contents
mv <directoryName><directoryName> // Move directory
```

In conclusion, there are endless resources on Terminal commands and options available to every shell that provides developers with built-in tools to allow convenience and efficiency. I will end with some 'cheat-sheets' that I have collected and I hope they help you as much as they have helped me.

[<u>Terminal Key Combinations</u>](https://keycombiner.com/collections/terminal/)
[VS Code Keyboard Commands](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf)
[GitHub Cheat Sheet](https://education.github.com/git-cheat-sheet-education.pdf)