March 2017
11 basic terminal commands for beginners
Filed under: Terminal, Tips, Tutorials, Web Development

A beginner guide to common terminal commands that make web development workflows faster and more precise.
Why bother with the command line
Most of the work a front-end developer does can be done through a visual application, right up until it cannot. Installing a build tool, checking what a server is doing, or moving two hundred files into a new folder structure are all faster typed than clicked.
The useful thing about the terminal is that it is small. Eleven commands cover a surprising amount of everyday work, and everything after that is learned when a specific job demands it.
Moving around
pwd prints the directory you are currently in, which is the answer to most confused moments. ls lists what is in that directory, and ls -la shows hidden files and permissions alongside it. cd changes directory, with cd .. moving up one level and cd on its own returning you home.
Those four commands are enough to navigate a whole project without touching a file browser.
Creating and removing
mkdir makes a directory and touch creates an empty file. cp copies, mv moves and also renames, and rm removes. rm is the one command worth respecting: there is no recycle bin behind it, and rm -rf on the wrong path is an unrecoverable afternoon.
A habit worth building early is to run ls in a directory before running rm inside it.
Reading without opening
cat prints a whole file to the screen, which is ideal for short configuration files. For anything longer, less pages through the file and quits with q. grep searches file contents for a pattern, and grep -r searches a whole tree, which is often the fastest way to find where a stray style rule or a hard-coded string actually lives.
Building the habit
The way to learn these is not to memorise them but to use the terminal for one task a day that you would normally do visually. Within a couple of weeks the commands stop being a list and start being reflexes, which is exactly when the more advanced tooling starts to feel approachable.
Next entry: Top 5 Technical SEO basics for Web Developers
Previous entry: Tips for great email marketing campaigns
Back to March 2017 or the front page.