You are currently offline, so some features of this site may not work fully.

Your browser doesn’t support some of the latest CSS features used to build this site.

Read more about my usage of new CSS features.

Note: I primarily use a Mac so this is going to be geared towards hipsters Mac users.

Navigating your environment

I barely ever use Finder on my Mac anymore as navigating your directory structure on your machine is super easy with the command line (even easier with shortcuts - more on that later).

Remember these

Change directory:


Change directory to your machine's root, for example:

cd ~

Back up one directory:

cd ..

List contents in a directory:


List contents in a directory, with full detail:

ls -la

Creating files

Creating files and directories is easy too - I often create a bunch via the command line before starting a project.

Use these

Create a directory (and head into it):

mkdir yourProject && cd yourProject
Note: Performing commands one after another with && makes things a little quicker too.

Create a file:

touch .gitignore

Write to a file (also creates files if it doesn't exist):

echo "Hello, World!" > index.html

Open a file:

open _yourProject.sublime-project

Open the directory you’re in:

open .


Searching your previous commands can be useful if your workflow involves a lot of repetition.

Try these

If you want to repeat a command you know you did a little while ago:


List a specific number of commands:

history 5

To search your history:

history | grep git

Where git is your search term.

When your command history comes back they'll all have indexes beside them, so to run one of the commands in the list use:


To run number 12 in the list for example.


You may know sudo for overriding privileges, running as an admin when you execute commands, but this pretty handy tip is to hit:

sudo !!

When you've tried to do something that fails without the correct privileges.

This simply repeats the previous command with superuser privileges.

Bonus round!

Your challenge:

  1. Don't use Finder for a day
  2. Create some shortcuts in your .bash_profile for your most frequently used navigational commands
  3. See how much quicker it is!
  4. Then comment below and let me know how you got on!


There’s not too much here yet but I’ll be adding to Command Line Ain’t Scary as I go, as well as writing more Ain’t Scary posts introducing front end technologies to beginners.