Skip to main content
X

Explore your training options in 10 minutes

Coding

How to Learn Bash

Karen Schwarze - February 15, 2021


Think of the last time you created a new file or navigated to a folder on your computer. You probably used a mouse or touchpad to do this, clicking until you made the new file or got inside the right folder. This is one way you can get around your computer system.

But another way to interact with your computer system is through a command line interface. A command line interface (also known as a CLI or shell), is a screen on your computer through which you can communicate with your operating system. By entering commands on a line (hence the term “command line”), you can quickly and easily manipulate files without using a mouse or touchpad.

That may not sound very exciting; after all, perhaps in a typical day, you aren’t opening that many files on your computer. However, as you continue in your tech career journey, you may need to manage more files and perform actions on those files quickly. This will certainly be the case if you end up working in web development, system administration, or DevOps (“ a set of practices that works to automate and integrate the processes between software development and IT teams”).

Get offers and scholarships from top coding schools illustration

Find Your Bootcamp Match

  • Career Karma matches you with top tech bootcamps
  • Access exclusive scholarships and prep courses










By continuing you agree to our Terms of Service and Privacy Policy , and you consent to receive offers and opportunities from Career Karma by telephone, text message, and email.

This is where a CLI like Bash comes in handy. With Bash, you can quickly manipulate files and move between folders. Let’s learn more about Bash and the best way to acquire this valuable workplace skill.

What Is Bash?

As mentioned, Bash is a type of CLI that you can use on your computer. We also say that we are “running Bash shell scripts” or use the term “Bash scripting language.” The commands that we write in Bash are “Bash commands.” You may see Bash referred to as both an interface and a language.

Bash runs on Unix-like operating systems. A Unix-like operating system behaves similarly to a Unix system, which follows a set of standards called Single UNIX Specification. Linux, Android, macOS, and iOS operating systems and PlayStation 3 and 4 system software are all considered Unix-like.

If you have a macOS or Linux-based operating system, there is a good chance that you already have Bash installed on your computer. If you have a Windows operating system, you likely don’t have Bash installed, as Windows is not a “Unix-like” operating system.

However, Windows users often install something called Git Bash , a package that includes Git and Bash. Git is a version control system used for tracking changes in a set of files. It is often used by developers for coordinating projects.

Just as a web browser functions as a GUI (Graphical User Interface) so that you can access websites on the Internet, so does a CLI such as Bash act as your portal for interacting with all the files on your computer. With Bash, you can also run programs, monitor your operating system, view logs (files that contain information about your operating system and usage), and configure servers.

What Is Bash Used For?

A CLI like Bash can help you in several ways. With Bash, you can:

  • Expedite tasks. Using a CLI like Bash saves you time as a programmer. Instead of clicking through multiple applications and folders on your computer to find a file, you can use the command line to write just a few lines of commands to pull up the files you need. This is especially helpful if you are managing many files of code on your computer as a developer.
  • Write scripts for frequent tasks. In Bash, you can create a script that encapsulates a list of commands. If you have used a language like Python (another scripting language), you have probably written commands and then compressed those commands into a single function. In Bash, you can do something similar: Instead of writing a list of commands to perform a task, you can write a script that encapsulates that list of commands, so you can type just one command instead of many.
  • Use for system administration . Using Bash scripting, you can learn how much memory and space you have available, check your log to see what actions your system has recently performed, and see what happened when your system booted up. You can also troubleshoot system processes, such as applications, and kill an application that is malfunctioning. With Bash, you can do things like writing a script to check a new user’s desired username against existing usernames to see if the username is already taken.

Learning to navigate your computer this way may be intimidating initially if you are used to only using applications. But once you get the hang of it, you may find that you prefer using your computer’s CLI for opening files over using web applications.

Learning Bash

If your goal is to become a web developer, it’s a good idea to learn Bash (or Git Bash if you have a Windows operating system). Many programmers choose to navigate their computers using Bash or another command line interface. If you are at least familiar with Bash, you can communicate about this technology with other developers you work with. Using Bash or another CLI can speed up the development process, increasing your productivity, an advantage whether you are an employee at a company or doing freelancing or consulting work.

Not only is learning Bash a good idea for your own workflow, but it’s also an in-demand skill. As of this writing, on LinkedIn there are over 14,000 job postings for roles in the United States that mention Bash. These roles include technical writer, DevOps software development engineer, cloud architect, and data analyst. Glassdoor lists over 9,000 roles that mention Bash. As you learn Bash, you can make yourself more marketable for a variety of roles in technology.

Venus, a software engineer at Rockbot

"Career Karma entered my life when I needed it most and quickly helped me match with a bootcamp. Two months after graduating, I found my dream job that aligned with my values and goals in life!"

Venus, Software Engineer at Rockbot

Let’s dig into the details of learning Bash.

How Long Does It Take to Learn Bash?

It will take you just one to two days to start writing your own basic scripts. However, just like programming languages, the Bash syntax has components like variables, loops, logic, and conditional expressions. It will take you three to four weeks to learn how to use these components to write more complex scripts, assuming you’re spending one to two hours a day practicing.

Depending on your experience with other command line interfaces and scripting languages (like Python or Perl), you may be able to pick up Bash even more quickly.

How to Learn Bash: Step-by-Step

When it comes to learning Bash, you should choose a process that fits the way you learn. Some developers prefer to immerse themselves in information about a topic before trying it out themselves, while others like to learn just enough to get started.

Here are some “big-picture” guidelines to follow as you learn Bash:

  1. Find out what operating system your computer has. If your operating system is Unix-like, such as a macOS or Linux, you likely already have Bash installed. If you have a Windows operating system, you’ll need to install Git Bash to use Bash.
  2. Get a basic understanding of command line interfaces (CLIs). Because Bash is a type of command line interface, it’s a good idea to understand the general purpose and function of a CLI. Think about what some of the advantages of navigating around your computer using a CLI might be instead of having to click inside different applications and folders. When you’re using a CLI, you are interacting with the files on your computer, so it’s important to know the basics to avoid making unwanted changes or overwriting files.
  3. Write scripts. Try writing your own scripts. If you are on Windows, it’s a great idea to follow a tutorial like this one from Traversy Media about how to install and use Git Bash and get started writing scripts. If you have a Unix-like operating system, check out this tutorial from BlondieBytes .
  4. Continue learning. Online courses and books are a helpful way to keep improving your skills. Review our lists below for the best courses and books to help you learn Bash.
  5. Get involved in the community. There are online forums where other Bash users ask and answer questions. As a developer, you will likely use many online resources, including online communities, to help you find solutions to technical problems. StackOverflow is one of these communities; check out their Bash questions page . ‘

The Best Bash Courses

There are courses available to help you understand Bash and related concepts like command line interfaces (CLIs) and Git. As you are growing your skills, these courses can help you practice your skills in a guided context.

Codecademy: Learn the Command Line
Cost: Codecademy Pro Membership ($19.99/month)


In this beginner-friendly course, you will learn how to navigate, access, and modify files and folders on your computer without using a mouse. These are all crucial skills for becoming a more productive developer. This learning experience takes eight hours to finish and has no prerequisites. You will receive a certificate upon completion.

Codecademy: Learn Bash Scripting

Cost: Codecademy Pro Membership ($19.99/month)

After completing Codecademy’s Learn the Command Line course, try your hand at Bash scripting with this learning experience. By the end of this course, you will be able to define variables and write conditions and loops for Bash scripts. This course takes just an hour to complete, and you will earn a certificate of completion.

Coursera: Introduction to Bash Shell Scripting

Cost: Coursera subscription (varies)

This course is a one-hour guided project for beginners. You will learn how to manipulate files and directories, write Bash shell scripts, and create aliases (command shortcuts). You’ll also understand how to create cron jobs, which are scheduled tasks for system maintenance.

Udemy: Complete Bash Shell Scripting

Cost: $29.99

After completing this course, you will understand shell scripting concepts, how to automate repetitive tasks, and how to write basic to advanced level scripts.

The requirements for this learning experience are that you have a Unix-like operating system, such as Linux or a macOS, and that you already know some basic commands for these operating systems. You’ll have access to 18.5 hours of video content and 59 downloadable resources, and you’ll receive a certificate upon completion.

Basket Weaving Books

Books are another great resource that you can use as you improve your Bash skills. Here are a few to get you started.

BASH Guide , Joseph Deveau

This book is perfect for beginners. It focuses on Bash, but the principles you learn can be applied to other shells. Once you become proficient at using the basics of Bash shell scripting, delve into the later chapters of the book to learn more advanced concepts such as duplication of file descriptors (using numbers to identify files), process substitution (referring to a process’s input or output as a file name), and traps (commands that respond to signals sent from the operating system).

Learning the bash Shell: Unix Shell Programming (In a Nutshell) , Cameron Newham

Image credit: Amazon

This book will help you understand how the Bash shell allows you to communicate with the computer, using your keyboard and the commands you see on your screen. This book will be helpful as a beginner and as your skills become more advanced. Through examples, you’ll get familiar with concepts like how to use an interactive shell, variables, and debugging strategies.

Classic Shell Scripting: Hidden Commands that Unlock the Power of Unix , Arnold Robbins and Nelson H.F. Beebe

Image credit: Amazon

This book assumes a basic understanding of shell scripts, so it’s best to read this once you feel comfortable with Bash and shell scripts generally.  You will learn how to use regular expressions and key Bash commands like sed (used for text transformation tasks such as find and replace) and awk (used for more complex transformations and formatting output). You’ll also understand concepts like control flow and file manipulation.

Bash Resources

In addition to using books and courses to help you learn Bash, you’ll want to take advantage of other resources that can expand your knowledge of this important tool.

Here are our top picks for online Bash resources.

YouTube Tutorials

Image credit: Traversy Media Shell Scripting Crash Course – Beginner Level

If you enjoy learning with videos, there are many informative Bash tutorials on YouTube. One of them is the Shell Scripting Crash Course (also linked in the title) by Traversy Media. Other useful videos include Joe Collins’ Beginner’s Guide to the Bash Terminal and this Terminal Crash Course (Bash) by Zach Gollwitzer. All of these videos teach you the basics of Bash and shell scripting with helpful explanations and examples.

Atlassian Git Bash Guide

Image credit: Atlassian Git Bash Guide

If you have a Windows operating system, you will need to install Git Bash in order to have the Bash shell on your computer. This guide by Atlassian provides information on how to get started with Git Bash. You can install Git Bash on the Git website . You can also read these steps to install Git Bash on a Windows operating system.

Bash Documentation

Image credit: Bash Documentation

One of the best resources to use when learning any new technology is its documentation. In the Bash documentation, you’ll find answers to common questions such as “What is Bash?” and “What is a shell?”. You’ll also learn about shell syntax, how to execute commands, and about other Bash features like arrays (lists) and conditional expressions (statements that are determined to be true or false).

Conclusion

Bash is a command line interface and is the scripting language that runs inside that interface. Using Bash, you can interact with your operating system without using a mouse or touchpad. You can run programs, manipulate files, manage servers, and write scripts for repetitive tasks. If you have a lot of files to manage, you can navigate them without constantly clicking through folders. Bash allows you to perform system maintenance through tasks like checking available memory and troubleshooting applications.

If you are pursuing a career in tech, learning how to use Bash is a smart idea (or Git Bash, if you’re using a Windows operating system). Knowing how to navigate through the contents of your computer quickly will save you time and make your processes more efficient. This is valuable if you are a busy web developer, system administrator, or DevOps engineer.

Even if you’re not pursuing a career in tech just yet, you may find that communicating with your computer through the command line is more interesting than clicking through folders.

About us: Career Karma is a platform designed to help job seekers find, research, and connect with job training programs to advance their careers. Learn about the CK publication.

What's Next?

Karen Schwarze

About the author: A former educator and edtech marketer, Karen is passionate about computer science education. She’s particularly fascinated by the connections between coding languages and English language/literature structures. This led her to build an edtech app where users create Python programs by manipulating literary devices like similes and metaphors. When she’s not writing, Karen enjoys watching comedy and reading books about history.

Skip to main content