6 Practical Uses for the Command Line (How I Got Started)

ASCII art in the terminal.

I’ve recently taken to using the command line a lot more, and it’s quickly become my favorite tool for many things. In years past, I’d find myself copying and pasting commands from Lifewire while trying to troubleshoot some random issue.

I really had no idea what I was doing.

But now I find the terminal to be an essential tool, and I’m excited to learn more.

What is the Command Line?

When you interact with a computer using a mouse or trackpad, you’re using something called a Graphical User Interface or GUI (pronounced “gooey”). The GUI is a visual representation of what’s happening in the computer. You can click to “open a folder,” or “drag a file to the trash,” for instance.

Such actions are simply pictorial representations of what’s happening in the machine. They make it easy for humans to understand what the computer is doing and what actions are possible.

The command line is a text-based interface for interacting with the computer. Instead of clicking, you type commands, one line at a time.

Why is the Terminal Useful?

In my opinion, one of the biggest advantages of the command line is speed. It takes some time to get familiar with commands, but once you do, you can whizz through your files with more speed and precision than you can through a GUI. Typing one command at a time might seem like a limitation, but I consider that a key feature of the command line. Focusing on one command at a time ensures that you get from point A to B as fast as possible.

Plus it makes you feel like a hacker who’s about to break the Matrix.

The command line is also useful simply because there are certain functions that are either clunky or impossible without it. This fact becomes more apparent the more you use it.

What the Terminal Has Opened Up for Me

Here is a short list of what I’ve learned to do in the terminal, as well as what possibilities have been opened to me:

1. Navigating Files + Accessing Hidden Files with Ease

In many instances it’s faster to navigate files and folders through the terminal than it is to use the GUI. The single command approach keeps me focused on what I’m actually looking for, which is helpful for navigating extensive file systems.

These days, I’m discovering that a lot of the files I need to access are hidden by default or are located in folders that aren’t as easily accessible via Finder. Using the terminal lets me see everything and switch through directories quickly to find what I need.

Finder uses the term “Folder” whereas terminal uses the term “Directory.” If you create a folder in Finder, it will display as a directory in terminal and vice versa.

Some of the command I use on a regular basis include:


Terminal supports autocomplete, so you could type something like cd De , press TAB and it will autocomplete to cd Desktop. You can also type in a lengthy file path such as cd Desktop/Projects/Client-1/Design and the terminal will take you to the Design directory.

2. Creating Directories and Files (with bulk creation ability)

I use MacOS, so in the GUI, I can right click in Finder to create a new folder or I can type Command+Shift+N. With terminal I can use some simple commands to build out directories and files with ease. Two handy commands are:

touch [filename.extension]     # CREATES A FILE WITHIN CURRENT DIRECTORY

Terminal also supports bulk creation of folders, so I can set up an entire file structure without repetive clicking and typing in Finder. For example,


In the screenshot below, I created a directory called Example within my web-projects directory. I also created some general folders and blank HTML, CSS, and JS documents. This whole process takes very little time and is a good way to get the basic folder structure for a project up and running. I’m sure that some of this could be automated with a Bash or Python script, and that’s on my list of things to learn.

Creating Directories and Files Using the Command Line

Side Note

For projects with a clearly defined folder structure such as video editing or podcast production, I also use free app called Post Haste. It enables you to create template folder structures and even implement standardized naming conventions for folders. It’s very handy and easy to use.

3. Generating SSH Keys and Updating the .config File

It took me a while to wrap my head around how to create and use SSH keys, but once I grasped the concept, I realized that knowing how to use SSH is essential if you do anything involving web dev or remote servers. I’m not really sure why I didn’t learn it sooner. Knowing how to navigate hidden folders makes generating and using SSH keys very straightforward.

SSH stands for Secure Shell, and it’s a way to create a secure connection to a remote server. SSH keys are comprised of a public and private key. You put the public key on the remote server, and the private key gets saved on your local machine. The public and private keys are basically a secret handshake between your computer and the remote server. When you try to log on to the remote server, the public key and private key work together to ensure that you’re an authorized user.

My current hosting provider, Siteground, allows you to create SSH keys through their dashboard. Likewise, my current password manager, 1Password, provides an option for generating and storing SSH keys through the app. However, my I’ve found the terminal to be my preferred way of handling this task. All I have to do is type in the following command, and my computer will generate a SSH key pair for me:


My computer gives me a prompt to give the key pair a name and password. Then it generates the key. The output looks like this:

Sample SSH Key Generation

My preference is to have a separate SSH key for every site I service instead of using one master key for everything.

The config file is a list of known remote servers and login credentials. If I want to login to a remote server, I need to type in the host name, user name, port, and password. The username that Siteground provides for SSH access is pretty long and wouldn’t be worth remembering even if I only had one site to manage.

The config file stores all of this information for me, so gaining SSH access to a site is a breeze. For example, lets say I have a site called www.mytestsite.com. The credentials might be:

  • HostName: ssh.mytestsite.com
  • User: f4531-dsle35jhd034
  • Port: 22
  • Identity File: ~/.ssh/mytestsite.txt

The HostName is the name of the remote server that I want to connect to. The User is my account. The port is where the connection will be made. And the Identity File is the path to the private SSH key that I created.

If I wanted to SSH into this account, I’d need to add my private key to the SSH-agent (which manages key access) and then type in the following:

ssh f4531-dsle35jhd034@ssh.mytestsite.com -p22

Not very user friendly, right?

To make things simpler, I can open up my config file and add the following:

Host MyTestSite
	HostName ssh.mytestsite.com
	User f4531-dsle35jhd034
	Port 22
	IdentityFile ~/.ssh/mytestsite.txt

Once I save the config file, I can SSH into the same site with this super simple command:

ssh MyTestSite

It makes accessing the back end of a site a breeze, and it enables me to to use the WordPress Command-Line Interface.

4. Using the WordPress Command-Line Interface (WP-CLI)

My main motivation for learning SSH access was to use the WordPress Command-Line Interface. The concept behind WP-CLI is to provide a text-based equivalent to all of the common functions that you can perform in the WordPress dashboard.

Now that I have my config file setup for the sites I manage, I can drill down to the plugins and themes directory and update things with a few simple commands. For example:

wp plugin list # LISTS ALL PLUGINS
wp plugin update [plugin-name]      # UPDATES SELECTED PLUGIN
wp plugin update -a                 # UPDATES ALL PLUGINS
wp plugin deactivate [plugin-name]  # DEACTIVATES SELECTED PLUGIN
wp plugin install [plugin-name]     # INSTALLS SELECTED PLUGIN
wp theme list                       # LISTS ALL THEMES
wp theme install [theme-name]       # INSTALLS SELECTED THEME
wp theme activate [theme-name]      # ACTIVATES SELECTED THEME
wp theme deactivate [theme-name]    # DEACTIVATES SELECTED THEME
wp theme uninstall [theme-name]     # UNINSTALLS SELECTED THEME
wp core version                     # DISPLAYS WP CORE VERSION
wp core update                      # UPDATES WP CORE VERSION
wp core install                     # RUNS WP INSTALL PROCESS

These commands just scratch the surface of what’s possible with WP-CLI. It takes a little setup to generate SSH keys, update the config file, and make sure everything is configured correctly on the remote server, but once you do, it takes seconds to access the site and perform general updates.

As a side benefit, if a site can’t load the WP Dashboard, WP-CLI provides a way to gain access the site in order to deactivate plugins and themes to rectify the issue.

You can learn more about WP-CLI by checking out the official documentation.

Further Reading

You can learn more about WP-CLI by checking out the official documentation.

5. Using Git + Github

Git is an open source version control system for development. Git helps you keep track of changes in a codebase, and it enables teams to work on a codebase simultaneously without overwriting each other’s changes. There are more benefits, but that’s the gist of it.

Although there are GUI applications for using Git, it makes more sense to use it in the terminal. I’ve been using Git while working through some tutorials on the Mozilla Developer Network. Learning some basic terminal navigation skills made picking up Git and GitHub much easier.

Example of Git Commands to Push to a Remote Repository

Further Reading

For a very helpful written tutorial on Git, check out What is Git from Atlassian. For a very helpful video tutorial, check out Git and GitHub for Beginners – Crash Course from freecodecamp.org. You can also refer to the official documentation.

6. Installing Packages Via Homebrew

Homebrew is a package manager that enables you to install packages and software directly from the command line. Once you’ve installed Homebrew, you can use it to download an impressive list of applications.

To install any of them, all you have to do is type brew install [package-name] For example, if I want to install Visual Studio Code on my computer, I’d type this into a terminal window:

brew install code

The value of this approach is that you don’t have to open a browser, navigate to the site, find where the download page is, download the package, and then install the package. Homebrew takes care of everything in one pass.

To learn more, visit the Homebrew website. There, you can find a list of packages that can be installed with Homebrew.

My Future Goals for Using the Terminal

Right now, I’m just scratching the surface of what can be done with the terminal. I’ve learned a few other things, like how to connect to a local MySQL server, which has been fun to use. I’ve also installed packages like Python, Node.js and NPM, but I haven’t made use of those (yet).

In the future, I’d like to learn some Bash and Python scripting so I can automate processes like spinning up client and project folders. My ideal use case would be to use WP-CLI to bulk install all of the standard plugins that I use on site builds via a script.

I’d also like to get more proficient in terminal commands. There are lots of conditions that can be added to commands which provide additional functionality.

My philosophy is that more manual processes tend to be more understandable and beneficial in the long run. Using the terminal fits into that ethos. The more I understand how the computer works at a system level, the more I’ll understand how my computer works in general.

At this point, I view the terminal as a tool. Sometimes its a better tool than the GUI; sometimes it’s not. In the automotive work I’ve done, I’ve learned that having the right tool makes all the difference.

Recommended Resources

Scroll to Top