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
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!
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.
Typing the following command will show you what can be found in that folder/directory:
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:
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.
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:
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.
Lastly, to delete files and folders, you should use the rm
command.
To delete an individual file you should do this:
Deleting a folder needs an extra bit of information. You should run this command:
Last updated