Too many smart people be afraid of the command line. Project Managers, QAs, even executives of tech companies stay well clear of anything with that menacing, blinking curser.
There is good news though: The terminal -at a basic level- is easy and certainly nothing to be intimidated by.
Now, I am no sys-admin. I know sys admins who can run four terminals simultaneously and seemingly control a different terminal with each hand (and foot?). However, fearing the command line because power users blow your mind is like being afraid to drive because you could never keep up witha race car driver. But don’t worry, you won’t find that person here. I am not a race car driver or a sys power user. Here you will find, simply, an introduction to the command line and a few, basic tasks – coming from someone who still remembers opening the terminal for the first time.
Maybe you have never needed the to use the terminal before. Maybe you have always been curious (and a little bit in awe) of people who could fire up the window and whisper commands right into their computer. Here is the secret, for most of what anyone would want to do in the command line, it is simple. Not only does using the command line impress your programmer and sys admin coworkers (thus giving you some street cred) it will also make some basic tasks a little simpler.
So, first things first. Lets get started and introduce the basic navigation tasks. I am using OSX.
1. Open the terminal: it will be the black box with the carrot sign on your dock, or, if you don’t see it, search for terminal in finder.

Yup, that one in the middle, if you have it set in your dock.
Yikes! There it is… the smug blinking cursor, taunting you.
Actually, that cursor is just blinking as a polite way of asking you what it can do for you. Thats right- you are the boss. Who knew? So, lets introduce ourselves:

Type: echo hello and press enter.
Look! It is even friendly.
Now, here is what you need to do about the command line:
- it will only do exactly what you tell it to do. If you are having trouble, make sure your script is correct. Any misspellings, un uppercase letter?
- There is no undo. Now, this isn’t something to be scared of, it is just something to be aware of.
Lets get started!
The first thing to do is find out where you are.
People use phrases like that a lot – and at first your response might be “I know exactly where I am- sitting here typing in my computer” but that isn’t quite true. You know how when you are reading a book, you may be in the library (or the restroom) but you are actually viewing far off lands? Exactly the same thing with the command line.
Where are you? You are strolling through your computer, viewing the items and files you have in various directories. From here, you can stroll through MyDocuments, or hop over to your Desktop. You can copy a file from your Downloads file into a new folder on your Desktop, or send it over to a different computer that you are directly connected to. You can search through log files and export the errors into a file to view them (I am talking to you, QA’s) or connect up to github (for example) and create new projects or pull the latest release and check it out (thats for you, Project Managers). All of that is no harder than typing in addresses in your internet browser.
Type: pwd. PWD stands for “Print Working Directory” or, in english “tell me where I am right now”

pwd : where am I?
Ok, so now you know that you are in the home folder for user: Arthur. But, you still can’t see anything around you. That is like knowing you are standing in a library, but all the lights are off and you can’t see any of the aisles or any of the books. Get ready for the most used command (that is not scientific, but I am pretty sure it is true).
Type: ls - which means, list the files in the directory I am in, or “show me what files are here”

ls -or- what can I see in here?
With ‘ls’ you can turn on the lights in the directory you are in. By that I mean, it allows you to see the files around you, just like turning on the lights in that library lets you see the shelves and books around you.
Usually, on your first ‘ls‘ you will see some familiar files ‘Desktop‘ ‘Documents‘ ‘Downloads‘ and ‘Applications‘. So there you are, standing there in your computer looking around at your options and you probably have some idea of what lies behind each of those ”doors.”
Lets say you want to grab a photo you just downloaded and move it to your desktop. To do that you need to: move to your download folder, find the file, and copy it to your desktop. That is 3 commands. Nothing to sweat about.
To switch in to your download folder, you need another command (maybe the second most popular): cd.
Step 1- type: cd Downloads - cd stands for ‘change directory’ or go to that place and by adding the name of the directory you want to go to, you tell it where to change to. You could also have written cd Documents or cd .. – did that look funny? cd .. means, “back up” and it moves you out of the current directory you are in back up one level. If you are on your desktop and you type cd photos then want to get out of that file, you would type ‘cd ..’ and find yourself back in your desktop.
Just like before, you want to ask yourself: Where am I? What can I see here? We already know those commands, in fact, I put the first one up in the screenshot above. Type pwd, like I did above and see that your working directory has changed to /users/Arthur/Downloads.
Step 2: The next thing to do, of course, is to find out what you can see in your new directory. To do that type: ls. Look for the photo in the list of downloaded files (in this case, photo.JPG) There are easier ways to search for things- but for now, just look through the list.
Step 3: Copy the file. Type: cp photo.JPG ../Desktop

This means copy the file photo.jpg back up one directory and over to your desktop.
Now, all you have to do is back out of Downloads yourself, head over to the Desktop and find your file. (cd ../Desktop/ and then ls). Your moved file will appear in the list for your desktop. If you go look at your GUI desktop, it will show up there too.

So, I know what you are thinking. What is the point? At basic levels- like browsing through files and changing your directory- you can do it through the UI (finder window, my computer etc) just the same. Sure, for something like moving a single file, you can always just drag it yourself, that is what the UI is for. But what if you had to move a whole directory, and instead of moving it to your desktop, you had to move it to a remote machine?
The main reason to do some of the basic things in the command line is to become more comfortable with it. At first, navigating around in the command line feels strange and foreign, but given time, it can actually feel natural.
Using the terminal will make it easier, not only to understand what developers and sys admins are talking about, it will make it easier for you to work with them and even to complete tasks of your own. Being comfortable in the terminal is an important skill for those of us who work with computers because it opens up a whole new set of possibilities.
As you get more comfortable with the basics, trying more complicated things is manageable. It doesn’t take a computer geek to run useful commands in the terminal, but beware, using the terminal just may make you into a geek before you know it.
