If you work for an agency, chances are you have multiple development environments. Some clients have you mirroring their engineering team’s setup, others you created to your preference, and yet more are relics of past configurations you’ve forgotten about.

In this situation, I have a hard time remembering which project needs a “bundle exec guard” versus an “npm start” to get my SASS compilers, linting tools, and other gems going. Lately, I’ve been enjoying the use of bash aliases to both act as a more organized system of inventory, and to maintain my sanity when toggling between development environments.

I’ve come up with a naming system that makes sense for me and it consists of two basic parts:

What am I doing?
For this, I have prefixes cd- for jumping to directories, start- for executing a series of commands to begin development, or nano- to open and edit configuration files (particularly those I don’t access often and forget URLs for).

To what project/file am I doing it?
That cd- then gets combined with shorthand for a client and project pair. For example, cd-a-intranet to replace “cd /Tree/Acme/acme-intranet/”. I like to have access to a client root as well, so I also define cd-acme.

Note: I know it’s possible to open a Finder window and drag it into Terminal for a quick cd, but that involves wasting time browsing through Finder. More on that in a moment.

After editing, follow the instructions to save and exit. Your bash profile is only loaded once at the beginning of a new Terminal session, so you’ll need to relaunch Terminal to test your new aliases.

Now for the fun part

I’ve given you everything you need to know to quickly jump around project folders and to start a variety of Terminal environments to begin development, but remember when I said I didn’t like opening Finder? You can have Terminal do that for you too.

Depending on how your project’s environment is configured, it likely falls into one of these camps:

Flat files, no host/server – Just a folder of HTML files with no virtual host or server.

A host/server with no frills – No watchers, guards, or other fancy tools, but a host URL, including virtual hosts.

For all of those, you can modify your start- alias to include some added open commands to automagically open your Finder window and launch your project in your web browser—all as part of your start process.

Open your Finder directory:

open .

Open an HTML file without a virtual host:

open "/Library/WebServer/Documents/Clients/Acme/acme-intranet/index.html"

Open a URL (e.g., a virtual host):

open "http://acme-intranet/index.php"

For something like Guard, you don’t actually need to do anything. It likely opens your browser windows already.

Open some other URL (e.g., GitHub Tickets assigned to you):

open "https://github.com/MyAgency/acme-ui-library/issues/assigned/anthonydpaul"

Use those in tandem, within your start- alias:

(Each command should be on a new line, within the quotes around the entire alias string.)

Open editing windows

Pair your Finder folder and browser window open commands with opening a handful of files in the editor of your choice. Use an asterisk to give a variable, particularly for prefixed project files within a larger repo (i.e., minisite.*.php).

Now you have the tools to quickly cd-a-intranet and start-a-intranet, opening everything you need when your server starts up—all with two quick keyboard commands.

Note: You can add your cd command into your start command, but I keep them apart because I’m often jumping into a directory to do things other than development.

As a closing tip, it’s a bit meta, but I also have a few aliases for remembering where my bash profile is, alongside those other host files I need to edit when I add a new project. These will be easier to remember when you haven’t used them in six months: