# Git and the Terminal

## Using the Terminal

Most developers would use Git through the terminal. The terminal a fantastic way of interacting with a computer in a text-based way. We don't expect anyone to have experience of using the terminal for this programme, most of us certainly didn't before university!

Through our coding platform, you will have access to a Linux based terminal. You may have come across this before when using a Raspberry Pi, and it works in the same way as the terminal on Apple computers, and can be used on Windows computers using the *Windows Subsystem for Linux (WSL)*.

### The Essentials

{% hint style="info" %}
Throughout this guide, we'll be giving you loads of terminal commands, if you see something in this format **\<something-here>**, you should replace 'something-here' with what the text asks for.

This could be a file name, a folder name, or some specific features of Git!
{% endhint %}

#### Navigation

One of the key things to do in the terminal is moving around your file system. On the left hand side of the terminal, you will see information which tells you which folder you are currently in. You can also see what folder you are currently in using this command.

```
pwd
```

Typing the following command will show you what can be found in that folder/directory:

```bash
ls
```

If you want to see all of the hidden files in the current folder, as well as the non-hidden ones, then you can run `ls -a` and `ls -la` will do the same, with the addition of showing the different permissions associated with files and folders. You can also add the name of a specific folder after **ls** to look inside that folder.

To move into another folder, you should use the following command:

```
cd <folder-name>
```

You should replace `<folder-name>` with the name of the folder you want to move into. This is great if you want to navigate deeper into the file system, but what about going backwards? Well to do that, you should type `cd ..` instead of typing it with a folder name.

#### Files and Folders

So now we know how to get around the file system with the terminal, but that isn't too helpful on its own! We want to be able to make new files and new folders!

This is the command you want to make a new folder, replacing `<folder-name>` with the name of the folder that you want to create.

```
mkdir <folder-name>
```

You can then navigate into the folder using the command explained before, and make some files inside of it! This is done using the **touch** command as follows:

```
touch <file-name>
```

{% hint style="info" %}
Remember to give your files extensions! This will let the coding platform give your file specific auto-completion hints and syntax highlighting!

Examples:

* `file.py` is a Python file.
* `file.java` is a Java file.
  {% endhint %}

Lastly, to delete files and folders, you should use the `rm` command.

To delete an individual file you should do this:

```
rm <file-name>
```

Deleting a folder needs an extra bit of information. You should run this command:

```
rm -r <folder-name>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hackathonsforschools.gitbook.io/student-summer-sprint-1/technical-workshops/how-to-use-git/git-and-the-terminal.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
