The Command line is a powerful tool and one you should become familiar with. Today most people use what is called a Graphical User Interface (GUI) to interact with their computer. A GUI is a way to communicate with a computer using icons and the "point-and-click" method. However, many software developers rely on the command line to perform tasks because it can increase efficiency and allow you to perform tasks not available through GUIs. In this post I will briefly touch up on what the command line is, how to access it, and display some time-saving shortcuts...
A Brief History Of the Command Line
During the 60's and 70's when computers were growing in popularity and functionality, many users would interact with one main computer, known as a mainframe, using a terminal. A terminal primarily consisted of a monitor and keyboard. Each user would use a remote terminal to communicate with the mainframe to perform tasks. Simply put, a computer terminal was a way for a user to interact with a computer to enter, display, and/or print data.
Nowadays, we emulate the terminal using a "terminal emulator" like Terminal in OSX. We no longer communicate with a remote computer but rather with the computer we are operating on.
Because we are operating on computers that are the complete package, when we start a terminal session, we are also initializing a shell program. What you see on the screen will be the shell program.
Because we are operating with the complete package, Your computer's terminal and shell program work together. Your terminal handles the input going in and displays the output to the shell. The software that handles the input and uses the computer's central processing unit to interpret input and render output is called the shell. If you are using a Mac, your default shell will most like be bash.
Using a Terminal Emulator
Now that we've discussed briefly the history of the terminal and how it works, let's discuss some commonly used commands and some less common but nifty shortcuts.
To launch a terminal session type "terminal" in your computer's finder or search spotlight (cmd space).
Once you are in the shell, here are some helpful commands to help you get started:
pwd
Print Working Directory: this command does exactly what it sounds like it does. Prints your Working Directory. It tells your terminal to display what directory/folder you are currently in.
ls
List: This command lists all of the files in your current directory.
cd and cd ~
Change Directory: These both will change your working directory to your home or root directory. You can also type a specific directory in which you would like to change your working directory to.
cd ..
This moves your working directory one directory up from your current working directory.
mkdir
Make Directory: This command creates a new directory or folder.
touch
This command creates a new file in your current working directory
ctrl a
Takes you back to the beginning of the line you are typing on.
ctrl e
Takes you to the end of of the line you are typing on.
ctrl l
Clears the screen.
ctrl c
Terminates whatever you are running.
These are just a few commands to get started with and some others that are useful to know. If you would like a more extensive list of commands Here is one that provides a lot of useful commands to know.
Top comments (1)
Great insight Danny! Thanks for the helpful post :)