<commit_before>---
title: Bash
---

## What is Bash?

<a>Bash</a> (short for Bourne Again SHell) is a Unix shell, and a command language interpreter. A shell is simply a macro processor that executes commands. It's the most widely used shell packaged by default for most Linux distributions, and a successor for the Korn shell (ksh) and the C shell (csh).


Many of the things that can be done in Linux via the graphical interface (GUI) can be done via command line. Some examples are:

* Editing files
* Adjusting the volume of the operating system
* Fetching web pages from the internet
* Automating work you do every day

You can read more about bash <a href="https://www.gnu.org/software/bash/">here</a>, via the <a href="https://www.gnu.org/software/bash/manual/html_node/index.html#SEC_Contents">GNU Documentation</a>, and via the <a href="http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html#toc10">tldp guide</a>.


## Using bash on the command line (Linux, OS X)

You can start using bash on most Linux and OS X operating systems by opening up a terminal.  Let's consider a simple hello world example. Open up your terminal, and write the following line (everything after the $ sign):

```
zach@marigold:~$ echo "Hello world!"
Hello world!
```

As you can see, we used the echo command to print the string "Hello world!" to the terminal.  


## Writing a bash script 

You can also put all of your bash commands into a .sh file, and run them from the command line. Say you had a bash script with the following contents:

```
#!/bin/bash<commit_msg>Update index.md (#26220)<commit_after>---
title: Bash
---

## What is Bash?

<a>Bash</a> (short for Bourne Again SHell) is a Unix shell, and a command language interpreter. A shell is simply a macro processor that executes commands. It's the most widely used shell packaged by default for most Linux distributions, and a successor to the Korn shell (ksh) and the C shell (csh).


Many of the things that can be done in Linux via the graphical interface (GUI) can be done via command line. Some examples are:

* Editing files
* Adjusting the volume of the operating system
* Fetching web pages from the internet
* Automating work you do every day

You can read more about bash <a href="https://www.gnu.org/software/bash/">here</a>, via the <a href="https://www.gnu.org/software/bash/manual/html_node/index.html#SEC_Contents">GNU Documentation</a>, and via the <a href="http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html#toc10">tldp guide</a>.


## Using bash in the command line (Linux, OS X)

You can start using bash on most Linux and OS X operating systems by opening up a terminal.  Let's consider a simple hello world example. Open up your terminal, and write the following line (everything after the $ sign):

```
zach@marigold:~$ echo "Hello world!"
Hello world!
```

As you can see, we used the echo command to print the string "Hello world!" to the terminal.  


## Writing a bash script 

You can also put all of your bash commands into a .sh file, and run them from the command line. Say you had a bash script with the following contents:

```
#!/bin/bash
{'fraction_non_alphanumeric': 0.09178433889602054, 'fraction_numerical': 0.002888318356867779, 'mean_word_length': 4.076547231270358, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3682872', 'n_tokens_mistral': 956, 'n_tokens_neox': 876, 'n_words': 455}