Editing the bash

Set up projects faster by learning a few simple commands

Updated February 27, 2019

The Command Line Interface has survived through decades of change to the computer itself by being very efficient at the meeting the core needs of computer users. One requirement that every computer user will have at some moment is the need to create or delete a new resource. Luckily, the CLI is delivered to us with a few simple tools for completing this task.

Making and destroying directories

Called by a variety of names, the common directory is the backbone of how a computer is organized. This means that everything in the computer you are using is likely housed in a directory. So to create anything new with your computer, you'll likely need to create a directory for your creation to have a home.

When we make new directories using the GUI tools provided to us, we often refer to it as making a new 'folder.' The two concepts are interchangable, but making a new folder or directory from the command line follows the directory terminology strictly.

mkdir is the command for making a new directory via the command line. If we wanted to make a new directory with the name of 'sales' the command would be mkdir sales.

However, if we created that directory by mistake, we must us a command to delete the unneeded resource. rm -r sales would effectively delete the recently created 'sales' directory. rm is the command to remove a file, but rm by itself only works on files and will not delete a directory. By adding -r to the command we are allowed to remove a directory. In the event that you have trouble deleting the file, you can use rm -rf to force the removal to move forward.

Midas touch

While the terms associated with the creation and deletion of directories are relatively straight forward, the command for creating new files requires some getting used to.

That's because the touch command will allow you to create files of any type but it was primarily intended to assist with modifying timestamps on existing files. The term makes far more sense when you think of it being used to designate when a file was last 'touched'.

Still, touch is indespensible when setting up projects, so it helps to understand the range of possibilities the command brings.

Using touch pizza would create a new empty file named 'pizza'. If you wanted that to be an .html file, simply use touch pizza.html. If you wanted to create an .jpg image file, then touch pizza.jpg would be used. Keep in mind, regardless what you call these files, they are empty by default and what you choose to call them will only matter to the application that tries to utilize the files later.

If you created a file by mistake or simply want to clean up unwanted files in your project, the same rm command applies to files. In the event that a file requires a forced removal, adding rm -f before the file name will aid in the file's removal.

echo chamber

Empty files aren't all that interesting but ...

Section Summary

Topic Recap
mkdir dsfsdkjfhsdkjfhdskfjdshksj



  1. Search for Terminal on your Mac or PowerShell on your Windows machine.

Trouble following along? Feel free to ask for #HALP in the New Pragmatic Slack Community.

Receive daily feedback and weekly meetings with Chris Courtney by signing up for monthly mentorship today!

Sign up today!