Intro to the Terminal

Intro to the Terminal

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 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.

Bash Shell

A POSIX-compliant, command processor, that generally runs in a text window, or console that accepts commands to perform actions. Bash is usually the default for most Unix & Linux distributions and like many other Unix shells, Bash supports command substitution, iteration, filename globbing, 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“, a pun on the name of the Bourne shell that it replaces and the notion of being “born again”.

Z Shell

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, command-line completion, and customizable prompts. After the release of macOS Catalina, zsh was adopted as the default login shell.

Options

Additional items can be installed through the terminal to further improve performance like VIM and 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 or even simply running $ vimtutor in your shell prompt.

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 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, which is an updated, faster NPM. And PNPM, a newer NPM with a different package resolution algorithm for more speed and efficiency. Obviously the best choice depends on personal preferences and needs

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

Manual Commands

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

File Navigation

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

Modifying

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.

Terminal Key Combinations
VS Code Keyboard Commands
GitHub Cheat Sheet

Leave a Reply

Your email address will not be published. Required fields are marked *